diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-03 07:54:08 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-03 07:54:08 +0000 |
commit | 23c371de25c5e981599dcc0f6c381842d05ae80d (patch) | |
tree | 4af9eeb75ea21bf6de15e2a9631e1088018fec30 | |
parent | 9816ff759cec9ef4b8774b649c695cd9d51ade80 (diff) | |
download | chromium_src-23c371de25c5e981599dcc0f6c381842d05ae80d.zip chromium_src-23c371de25c5e981599dcc0f6c381842d05ae80d.tar.gz chromium_src-23c371de25c5e981599dcc0f6c381842d05ae80d.tar.bz2 |
Move chrome.power API from chrome/ to extensions/.
BUG=389348
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/363993003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281220 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 56 insertions, 78 deletions
diff --git a/chrome/browser/chromeos/policy/power_policy_browsertest.cc b/chrome/browser/chromeos/policy/power_policy_browsertest.cc index 11378c8..e8a21d6 100644 --- a/chrome/browser/chromeos/policy/power_policy_browsertest.cc +++ b/chrome/browser/chromeos/policy/power_policy_browsertest.cc @@ -24,14 +24,12 @@ #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/extensions/api/power/power_api_manager.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" -#include "chrome/common/extensions/api/power.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/chromeos_paths.h" #include "chromeos/chromeos_switches.h" @@ -51,6 +49,8 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/api/power/power_api_manager.h" +#include "extensions/common/api/power.h" #include "policy/proto/device_management_backend.pb.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -481,7 +481,7 @@ IN_PROC_BROWSER_TEST_F(PowerPolicyInSessionBrowserTest, AllowScreenWakeLocks) { // Pretend an extension grabs a screen wake lock. const char kExtensionId[] = "abcdefghijklmnopabcdefghijlkmnop"; extensions::PowerApiManager::Get(browser()->profile())->AddRequest( - kExtensionId, extensions::api::power::LEVEL_DISPLAY); + kExtensionId, extensions::core_api::power::LEVEL_DISPLAY); base::RunLoop().RunUntilIdle(); // Check that the lock is in effect (ignoring ac_idle_action, diff --git a/chrome/browser/extensions/browser_context_keyed_service_factories.cc b/chrome/browser/extensions/browser_context_keyed_service_factories.cc index b07d2d4..900067e 100644 --- a/chrome/browser/extensions/browser_context_keyed_service_factories.cc +++ b/chrome/browser/extensions/browser_context_keyed_service_factories.cc @@ -35,7 +35,6 @@ #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h" #include "chrome/browser/extensions/api/networking_private/networking_private_event_router_factory.h" #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" -#include "chrome/browser/extensions/api/power/power_api_manager.h" #include "chrome/browser/extensions/api/preference/chrome_direct_setting_api.h" #include "chrome/browser/extensions/api/preference/preference_api.h" #include "chrome/browser/extensions/api/processes/processes_api.h" @@ -65,6 +64,7 @@ #include "chrome/browser/extensions/token_cache/token_cache_service_factory.h" #include "chrome/browser/speech/extension_api/tts_extension_api.h" #include "extensions/browser/api/api_resource_manager.h" +#include "extensions/browser/api/power/power_api_manager.h" #include "extensions/browser/api/usb/usb_device_resource.h" #if defined(OS_CHROMEOS) diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index f7199e8..f834b69 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -799,10 +799,6 @@ 'browser/extensions/api/permissions/permissions_api.h', 'browser/extensions/api/permissions/permissions_api_helpers.cc', 'browser/extensions/api/permissions/permissions_api_helpers.h', - 'browser/extensions/api/power/power_api.cc', - 'browser/extensions/api/power/power_api.h', - 'browser/extensions/api/power/power_api_manager.cc', - 'browser/extensions/api/power/power_api_manager.h', 'browser/extensions/api/preference/chrome_direct_setting.cc', 'browser/extensions/api/preference/chrome_direct_setting.h', 'browser/extensions/api/preference/chrome_direct_setting_api.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index d241327..fdbca33 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -538,6 +538,7 @@ # they should be kept here. '../extensions/browser/admin_policy_unittest.cc', '../extensions/browser/api/api_resource_manager_unittest.cc', + '../extensions/browser/api/power/power_api_unittest.cc', '../extensions/browser/api/storage/settings_quota_unittest.cc', '../extensions/browser/api/storage/settings_test_util.cc', '../extensions/browser/api/storage/settings_test_util.h', @@ -922,7 +923,6 @@ 'browser/extensions/api/messaging/native_messaging_policy_handler_unittest.cc', 'browser/extensions/api/omnibox/omnibox_unittest.cc', 'browser/extensions/api/permissions/permissions_api_helpers_unittest.cc', - 'browser/extensions/api/power/power_api_unittest.cc', 'browser/extensions/api/preference/preference_api_prefs_unittest.cc', 'browser/extensions/api/proxy/proxy_api_helpers_unittest.cc', 'browser/extensions/api/push_messaging/obfuscated_gaia_id_fetcher_unittest.cc', diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 77e68ca..5f7fd39 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json @@ -569,10 +569,6 @@ "extension_types": ["extension", "legacy_packaged_app", "platform_app"], "contexts": ["blessed_extension"] }, - "power": { - "dependencies": ["permission:power"], - "contexts": ["blessed_extension"] - }, "preferencesPrivate": { "dependencies": ["permission:preferencesPrivate"], "contexts": ["blessed_extension"] diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json index 64efbd3..fe87793 100644 --- a/chrome/common/extensions/api/_permission_features.json +++ b/chrome/common/extensions/api/_permission_features.json @@ -798,12 +798,6 @@ "channel": "stable", "extension_types": ["extension", "legacy_packaged_app"] }, - "power": { - "channel": "stable", - "extension_types": [ - "extension", "legacy_packaged_app", "platform_app" - ] - }, "preferencesPrivate": { "channel": "stable", "extension_types": [ diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp index 1d3b4fa..5d86148 100644 --- a/chrome/common/extensions/api/api.gyp +++ b/chrome/common/extensions/api/api.gyp @@ -87,7 +87,6 @@ 'omnibox.json', 'page_capture.json', 'permissions.json', - 'power.idl', 'preferences_private.json', 'push_messaging.idl', 'reading_list_private.json', diff --git a/chrome/common/extensions/permissions/chrome_api_permissions.cc b/chrome/common/extensions/permissions/chrome_api_permissions.cc index cd817d4..1fccc8f 100644 --- a/chrome/common/extensions/permissions/chrome_api_permissions.cc +++ b/chrome/common/extensions/permissions/chrome_api_permissions.cc @@ -129,7 +129,6 @@ std::vector<APIPermissionInfo*> ChromeAPIPermissions::GetAllPermissions() APIPermissionInfo::kFlagNone, IDS_EXTENSION_PROMPT_WARNING_NATIVE_MESSAGING, PermissionMessage::kNativeMessaging}, - {APIPermission::kPower, "power"}, {APIPermission::kPrivacy, "privacy", APIPermissionInfo::kFlagNone, IDS_EXTENSION_PROMPT_WARNING_PRIVACY, PermissionMessage::kPrivacy}, {APIPermission::kProcesses, "processes", APIPermissionInfo::kFlagNone, diff --git a/extensions/DEPS b/extensions/DEPS index 3e4f6ad..0505b02 100644 --- a/extensions/DEPS +++ b/extensions/DEPS @@ -37,6 +37,7 @@ specific_include_rules = { "+chrome/common/chrome_paths.h", "+chrome/common/extensions/features/feature_channel.h", "+chrome/common/extensions/manifest_tests/extension_manifest_test.h", + "+chrome/test/base/browser_with_test_window_test.h", "+chrome/test/base/testing_profile.h", "+chrome/test/base/ui_test_utils.h", ], diff --git a/chrome/browser/extensions/api/power/OWNERS b/extensions/browser/api/power/OWNERS index 3c97e54..3c97e54 100644 --- a/chrome/browser/extensions/api/power/OWNERS +++ b/extensions/browser/api/power/OWNERS diff --git a/chrome/browser/extensions/api/power/power_api.cc b/extensions/browser/api/power/power_api.cc index e014b9a..d731b9f 100644 --- a/chrome/browser/extensions/api/power/power_api.cc +++ b/extensions/browser/api/power/power_api.cc @@ -1,19 +1,19 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 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. -#include "chrome/browser/extensions/api/power/power_api.h" +#include "extensions/browser/api/power/power_api.h" -#include "chrome/browser/extensions/api/power/power_api_manager.h" -#include "chrome/common/extensions/api/power.h" +#include "extensions/browser/api/power/power_api_manager.h" +#include "extensions/common/api/power.h" namespace extensions { bool PowerRequestKeepAwakeFunction::RunSync() { - scoped_ptr<api::power::RequestKeepAwake::Params> params( - api::power::RequestKeepAwake::Params::Create(*args_)); + scoped_ptr<core_api::power::RequestKeepAwake::Params> params( + core_api::power::RequestKeepAwake::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params); - EXTENSION_FUNCTION_VALIDATE(params->level != api::power::LEVEL_NONE); + EXTENSION_FUNCTION_VALIDATE(params->level != core_api::power::LEVEL_NONE); PowerApiManager::Get(browser_context())->AddRequest( extension_id(), params->level); return true; diff --git a/chrome/browser/extensions/api/power/power_api.h b/extensions/browser/api/power/power_api.h index 6b12d2a..505cc42 100644 --- a/chrome/browser/extensions/api/power/power_api.h +++ b/extensions/browser/api/power/power_api.h @@ -1,9 +1,9 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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. -#ifndef CHROME_BROWSER_EXTENSIONS_API_POWER_POWER_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_POWER_POWER_API_H_ +#ifndef EXTENSIONS_BROWSER_API_POWER_POWER_API_H_ +#define EXTENSIONS_BROWSER_API_POWER_POWER_API_H_ #include "extensions/browser/extension_function.h" @@ -35,4 +35,4 @@ class PowerReleaseKeepAwakeFunction : public SyncExtensionFunction { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_POWER_POWER_API_H_ +#endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_H_ diff --git a/chrome/browser/extensions/api/power/power_api_manager.cc b/extensions/browser/api/power/power_api_manager.cc index 80bda7c..9a8d0d5 100644 --- a/chrome/browser/extensions/api/power/power_api_manager.cc +++ b/extensions/browser/api/power/power_api_manager.cc @@ -1,13 +1,11 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 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. -#include "chrome/browser/extensions/api/power/power_api_manager.h" +#include "extensions/browser/api/power/power_api_manager.h" #include "base/bind.h" #include "base/lazy_instance.h" -#include "chrome/browser/chrome_notification_types.h" -#include "content/public/browser/notification_service.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h" @@ -18,12 +16,12 @@ namespace { const char kPowerSaveBlockerReason[] = "extension"; content::PowerSaveBlocker::PowerSaveBlockerType -LevelToPowerSaveBlockerType(api::power::Level level) { +LevelToPowerSaveBlockerType(core_api::power::Level level) { switch (level) { - case api::power::LEVEL_SYSTEM: + case core_api::power::LEVEL_SYSTEM: return content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension; - case api::power::LEVEL_DISPLAY: // fallthrough - case api::power::LEVEL_NONE: + case core_api::power::LEVEL_DISPLAY: // fallthrough + case core_api::power::LEVEL_NONE: return content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep; } NOTREACHED() << "Unhandled level " << level; @@ -47,7 +45,7 @@ PowerApiManager::GetFactoryInstance() { } void PowerApiManager::AddRequest(const std::string& extension_id, - api::power::Level level) { + core_api::power::Level level) { extension_levels_[extension_id] = level; UpdatePowerSaveBlocker(); } @@ -63,13 +61,6 @@ void PowerApiManager::SetCreateBlockerFunctionForTesting( base::Bind(&content::PowerSaveBlocker::Create); } -void PowerApiManager::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK_EQ(type, chrome::NOTIFICATION_APP_TERMINATING); - power_save_blocker_.reset(); -} - void PowerApiManager::OnExtensionUnloaded( content::BrowserContext* browser_context, const Extension* extension, @@ -81,10 +72,8 @@ void PowerApiManager::OnExtensionUnloaded( PowerApiManager::PowerApiManager(content::BrowserContext* context) : browser_context_(context), create_blocker_function_(base::Bind(&content::PowerSaveBlocker::Create)), - current_level_(api::power::LEVEL_SYSTEM) { + current_level_(core_api::power::LEVEL_SYSTEM) { ExtensionRegistry::Get(browser_context_)->AddObserver(this); - registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, - content::NotificationService::AllSources()); } PowerApiManager::~PowerApiManager() {} @@ -95,10 +84,10 @@ void PowerApiManager::UpdatePowerSaveBlocker() { return; } - api::power::Level new_level = api::power::LEVEL_SYSTEM; + core_api::power::Level new_level = core_api::power::LEVEL_SYSTEM; for (ExtensionLevelMap::const_iterator it = extension_levels_.begin(); it != extension_levels_.end(); ++it) { - if (it->second == api::power::LEVEL_DISPLAY) + if (it->second == core_api::power::LEVEL_DISPLAY) new_level = it->second; } @@ -119,6 +108,7 @@ void PowerApiManager::Shutdown() { // Unregister here rather than in the d'tor; otherwise this call will recreate // the already-deleted ExtensionRegistry. ExtensionRegistry::Get(browser_context_)->RemoveObserver(this); + power_save_blocker_.reset(); } } // namespace extensions diff --git a/chrome/browser/extensions/api/power/power_api_manager.h b/extensions/browser/api/power/power_api_manager.h index 9cd729f..477113d 100644 --- a/chrome/browser/extensions/api/power/power_api_manager.h +++ b/extensions/browser/api/power/power_api_manager.h @@ -1,21 +1,19 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 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. -#ifndef CHROME_BROWSER_EXTENSIONS_API_POWER_POWER_API_MANAGER_H_ -#define CHROME_BROWSER_EXTENSIONS_API_POWER_POWER_API_MANAGER_H_ +#ifndef EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_ +#define EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_ #include <map> #include <string> #include "base/callback.h" #include "base/memory/scoped_ptr.h" -#include "chrome/common/extensions/api/power.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" #include "content/public/browser/power_save_blocker.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_registry_observer.h" +#include "extensions/common/api/power.h" namespace content { class BrowserContext; @@ -28,7 +26,6 @@ namespace extensions { // regular and incognito profile will share the same instance. // TODO(derat): Move this to power_api.h and rename it to PowerApi. class PowerApiManager : public BrowserContextKeyedAPI, - public content::NotificationObserver, public extensions::ExtensionRegistryObserver { public: typedef base::Callback<scoped_ptr<content::PowerSaveBlocker>( @@ -42,7 +39,8 @@ class PowerApiManager : public BrowserContextKeyedAPI, // Adds an extension lock at |level| for |extension_id|, replacing the // extension's existing lock, if any. - void AddRequest(const std::string& extension_id, api::power::Level level); + void AddRequest(const std::string& extension_id, + core_api::power::Level level); // Removes an extension lock for an extension. Calling this for an // extension id without a lock will do nothing. @@ -52,11 +50,6 @@ class PowerApiManager : public BrowserContextKeyedAPI, // objects. Passing an empty callback will revert to the default. void SetCreateBlockerFunctionForTesting(CreateBlockerFunction function); - // Overridden from content::NotificationObserver. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; - // Overridden from extensions::ExtensionRegistryObserver. virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, const Extension* extension, @@ -81,8 +74,6 @@ class PowerApiManager : public BrowserContextKeyedAPI, content::BrowserContext* browser_context_; - content::NotificationRegistrar registrar_; - // Function that should be called to create PowerSaveBlocker objects. // Tests can change this to record what would've been done instead of // actually changing the system power-saving settings. @@ -92,11 +83,11 @@ class PowerApiManager : public BrowserContextKeyedAPI, // Current level used by |power_save_blocker_|. Meaningless if // |power_save_blocker_| is NULL. - api::power::Level current_level_; + core_api::power::Level current_level_; // Map from extension ID to the corresponding level for each extension // that has an outstanding request. - typedef std::map<std::string, api::power::Level> ExtensionLevelMap; + typedef std::map<std::string, core_api::power::Level> ExtensionLevelMap; ExtensionLevelMap extension_levels_; DISALLOW_COPY_AND_ASSIGN(PowerApiManager); @@ -104,4 +95,4 @@ class PowerApiManager : public BrowserContextKeyedAPI, } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_POWER_POWER_API_MANAGER_H_ +#endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_ diff --git a/chrome/browser/extensions/api/power/power_api_unittest.cc b/extensions/browser/api/power/power_api_unittest.cc index 895b01a..ffb7e44 100644 --- a/chrome/browser/extensions/api/power/power_api_unittest.cc +++ b/extensions/browser/api/power/power_api_unittest.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 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. -#include "chrome/browser/extensions/api/power/power_api.h" +#include "extensions/browser/api/power/power_api.h" #include <deque> #include <string> @@ -11,13 +11,10 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/extensions/api/power/power_api_manager.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/test/base/browser_with_test_window_test.h" -#include "content/public/browser/notification_details.h" -#include "content/public/browser/notification_source.h" #include "content/public/browser/power_save_blocker.h" +#include "extensions/browser/api/power/power_api_manager.h" #include "extensions/common/extension.h" namespace utils = extension_function_test_utils; diff --git a/extensions/common/api/BUILD.gn b/extensions/common/api/BUILD.gn index 5a8c7db..b15addc 100644 --- a/extensions/common/api/BUILD.gn +++ b/extensions/common/api/BUILD.gn @@ -9,6 +9,7 @@ generated_extensions_api("extensions_api") { "app_runtime.idl", "dns.idl", "extensions_manifest_types.json", + "power.idl", "socket.idl", "sockets_tcp.idl", "sockets_tcp_server.idl", diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json index 084428e..944436e 100644 --- a/extensions/common/api/_api_features.json +++ b/extensions/common/api/_api_features.json @@ -40,6 +40,10 @@ "dependencies": ["permission:dns"], "contexts": ["blessed_extension"] }, + "power": { + "dependencies": ["permission:power"], + "contexts": ["blessed_extension"] + }, "runtime": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app", "platform_app"], diff --git a/extensions/common/api/_permission_features.json b/extensions/common/api/_permission_features.json index e0a8666..b1653fc 100644 --- a/extensions/common/api/_permission_features.json +++ b/extensions/common/api/_permission_features.json @@ -36,6 +36,10 @@ ] } ], + "power": { + "channel": "stable", + "extension_types": [ "extension", "legacy_packaged_app", "platform_app" ] + }, // Note: runtime is not actually a permission, but some systems check these // values to verify restrictions. "runtime": { diff --git a/extensions/common/api/api.gyp b/extensions/common/api/api.gyp index cfb880f..285c96e 100644 --- a/extensions/common/api/api.gyp +++ b/extensions/common/api/api.gyp @@ -26,6 +26,7 @@ 'app_runtime.idl', 'dns.idl', 'extensions_manifest_types.json', + 'power.idl', 'runtime.json', 'socket.idl', 'sockets_tcp.idl', diff --git a/chrome/common/extensions/api/power.idl b/extensions/common/api/power.idl index 8b40dda..2a25353 100644 --- a/chrome/common/extensions/api/power.idl +++ b/extensions/common/api/power.idl @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 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. diff --git a/extensions/common/permissions/extensions_api_permissions.cc b/extensions/common/permissions/extensions_api_permissions.cc index 9c71309..8305019 100644 --- a/extensions/common/permissions/extensions_api_permissions.cc +++ b/extensions/common/permissions/extensions_api_permissions.cc @@ -25,6 +25,7 @@ std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions() const { APIPermissionInfo::InitInfo permissions_to_register[] = { {APIPermission::kDns, "dns"}, + {APIPermission::kPower, "power"}, // Because warning messages for the "socket" permission vary based // on the permissions parameters, no message ID or message text is // specified here. The message ID and text used will be diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index bf75120..79cbe9b 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -266,6 +266,10 @@ 'browser/api/dns/host_resolver_wrapper.h', 'browser/api/extensions_api_client.cc', 'browser/api/extensions_api_client.h', + 'browser/api/power/power_api.cc', + 'browser/api/power/power_api.h', + 'browser/api/power/power_api_manager.cc', + 'browser/api/power/power_api_manager.h', 'browser/api/runtime/runtime_api.cc', 'browser/api/runtime/runtime_api.h', 'browser/api/runtime/runtime_api_delegate.cc', |