mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for Chrome Alarms Extension API (issue #1947)
This commit is contained in:
committed by
Marshall Greenblatt
parent
64e6971099
commit
dddfce456c
@@ -7,12 +7,14 @@
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "extensions/browser/api/alarms/alarm_manager.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
AlarmManager::GetFactoryInstance();
|
||||
CookieSettingsFactory::GetInstance();
|
||||
PrefsTabHelper::GetServiceInstance();
|
||||
RendererStartupHelperFactory::GetInstance();
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#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/api/alarms/alarms_api.h"
|
||||
#include "extensions/browser/extension_function_registry.h"
|
||||
|
||||
namespace extensions {
|
||||
@@ -29,6 +30,12 @@ const char* const kSupportedAPIs[] = {
|
||||
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
|
||||
"streamsPrivate",
|
||||
EXTENSION_FUNCTION_NAME(StreamsPrivateAbortFunction),
|
||||
"alarms",
|
||||
EXTENSION_FUNCTION_NAME(AlarmsCreateFunction),
|
||||
EXTENSION_FUNCTION_NAME(AlarmsGetFunction),
|
||||
EXTENSION_FUNCTION_NAME(AlarmsGetAllFunction),
|
||||
EXTENSION_FUNCTION_NAME(AlarmsClearFunction),
|
||||
EXTENSION_FUNCTION_NAME(AlarmsClearAllFunction),
|
||||
"tabs",
|
||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction),
|
||||
EXTENSION_FUNCTION_NAME(cefimpl::TabsExecuteScriptFunction),
|
||||
@@ -55,6 +62,11 @@ bool ChromeFunctionRegistry::IsSupported(const std::string& name) {
|
||||
void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
|
||||
registry->RegisterFunction<ResourcesPrivateGetStringsFunction>();
|
||||
registry->RegisterFunction<StreamsPrivateAbortFunction>();
|
||||
registry->RegisterFunction<AlarmsCreateFunction>();
|
||||
registry->RegisterFunction<AlarmsGetFunction>();
|
||||
registry->RegisterFunction<AlarmsGetAllFunction>();
|
||||
registry->RegisterFunction<AlarmsClearFunction>();
|
||||
registry->RegisterFunction<AlarmsClearAllFunction>();
|
||||
registry->RegisterFunction<cefimpl::TabsExecuteScriptFunction>();
|
||||
registry->RegisterFunction<cefimpl::TabsInsertCSSFunction>();
|
||||
registry->RegisterFunction<cefimpl::TabsGetFunction>();
|
||||
|
@@ -480,6 +480,9 @@ scoped_refptr<const Extension> CefExtensionSystem::CreateExtension(
|
||||
}
|
||||
return Extension::Create(
|
||||
info.root_directory,
|
||||
// Tests should continue to use the Manifest::COMMAND_LINE value here
|
||||
// Some Chrome APIs will cause undesired effects if this is incorrect
|
||||
// e.g.: alarms API has 1 minute minimum applied to Packed Extensions
|
||||
info.internal ? Manifest::COMPONENT : Manifest::COMMAND_LINE,
|
||||
*info.manifest, flags, utf8_error);
|
||||
}
|
||||
|
Reference in New Issue
Block a user