2016-07-20 20:03:38 +02:00
|
|
|
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
// APIs must also be registered in
|
|
|
|
// libcef/common/extensions/api/_*_features.json files. See
|
|
|
|
// libcef/common/extensions/api/README.txt for additional details.
|
|
|
|
|
|
|
|
#include "libcef/browser/extensions/chrome_api_registration.h"
|
|
|
|
|
|
|
|
#include "libcef/browser/extensions/api/tabs/tabs_api.h"
|
|
|
|
|
|
|
|
#include "chrome/browser/extensions/api/resources_private/resources_private_api.h"
|
|
|
|
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
|
|
|
|
#include "extensions/browser/extension_function_registry.h"
|
|
|
|
|
|
|
|
namespace extensions {
|
|
|
|
namespace api {
|
|
|
|
namespace cef {
|
|
|
|
|
|
|
|
namespace cefimpl = extensions::cef;
|
|
|
|
|
|
|
|
#define EXTENSION_FUNCTION_NAME(classname) classname::function_name()
|
|
|
|
|
|
|
|
// Only add APIs to this list that have been tested in CEF.
|
|
|
|
// static
|
|
|
|
bool ChromeFunctionRegistry::IsSupported(const std::string& name) {
|
|
|
|
static const char* const supported_apis[] = {
|
2017-05-17 11:29:28 +02:00
|
|
|
"resourcesPrivate",
|
|
|
|
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
|
|
|
|
"streamsPrivate",
|
|
|
|
EXTENSION_FUNCTION_NAME(StreamsPrivateAbortFunction),
|
|
|
|
"tabs",
|
|
|
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction),
|
|
|
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomFunction),
|
|
|
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomFunction),
|
|
|
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomSettingsFunction),
|
|
|
|
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomSettingsFunction),
|
2016-07-20 20:03:38 +02:00
|
|
|
};
|
|
|
|
for (size_t i = 0; i < arraysize(supported_apis); ++i) {
|
|
|
|
if (name == supported_apis[i])
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only add APIs to this list that have been tested in CEF.
|
|
|
|
// static
|
|
|
|
void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
|
|
|
|
registry->RegisterFunction<ResourcesPrivateGetStringsFunction>();
|
|
|
|
registry->RegisterFunction<StreamsPrivateAbortFunction>();
|
2016-10-17 20:14:44 +02:00
|
|
|
registry->RegisterFunction<cefimpl::TabsGetFunction>();
|
2016-07-20 20:03:38 +02:00
|
|
|
registry->RegisterFunction<cefimpl::TabsSetZoomFunction>();
|
|
|
|
registry->RegisterFunction<cefimpl::TabsGetZoomFunction>();
|
|
|
|
registry->RegisterFunction<cefimpl::TabsSetZoomSettingsFunction>();
|
|
|
|
registry->RegisterFunction<cefimpl::TabsGetZoomSettingsFunction>();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace cef
|
|
|
|
} // namespace api
|
|
|
|
} // namespace extensions
|