Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: extensions/browser/api/power/power_api_manager.h

Issue 363993003: Move chrome.power API from chrome/ to extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix quotes in gn file Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/power/power_api.cc ('k') | extensions/browser/api/power/power_api_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/power/power_api_manager.h
diff --git a/chrome/browser/extensions/api/power/power_api_manager.h b/extensions/browser/api/power/power_api_manager.h
similarity index 79%
rename from chrome/browser/extensions/api/power/power_api_manager.h
rename to extensions/browser/api/power/power_api_manager.h
index 9cd729fa6fb8458e75585032263929c75f653688..eedb3e4a46b390214c902fabbb37b44936e8687d 100644
--- a/chrome/browser/extensions/api/power/power_api_manager.h
+++ b/extensions/browser/api/power/power_api_manager.h
@@ -2,20 +2,18 @@
// 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_
« no previous file with comments | « extensions/browser/api/power/power_api.cc ('k') | extensions/browser/api/power/power_api_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698