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

Side by Side Diff: extensions/browser/api/power/power_api_manager.h

Issue 946643002: Use PowerSaveBlocker for audio and video on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply nits Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_
6 #define EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_ 6 #define EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 // Handles calls made via the chrome.power API. There is a separate instance of 24 // Handles calls made via the chrome.power API. There is a separate instance of
25 // this class for each profile, as requests are tracked by extension ID, but a 25 // this class for each profile, as requests are tracked by extension ID, but a
26 // regular and incognito profile will share the same instance. 26 // regular and incognito profile will share the same instance.
27 // TODO(derat): Move this to power_api.h and rename it to PowerApi. 27 // TODO(derat): Move this to power_api.h and rename it to PowerApi.
28 class PowerApiManager : public BrowserContextKeyedAPI, 28 class PowerApiManager : public BrowserContextKeyedAPI,
29 public extensions::ExtensionRegistryObserver { 29 public extensions::ExtensionRegistryObserver {
30 public: 30 public:
31 typedef base::Callback<scoped_ptr<content::PowerSaveBlocker>( 31 typedef base::Callback<scoped_ptr<content::PowerSaveBlocker>(
32 content::PowerSaveBlocker::PowerSaveBlockerType, 32 content::PowerSaveBlocker::PowerSaveBlockerType,
33 content::PowerSaveBlocker::Reason,
33 const std::string&)> CreateBlockerFunction; 34 const std::string&)> CreateBlockerFunction;
34 35
35 static PowerApiManager* Get(content::BrowserContext* context); 36 static PowerApiManager* Get(content::BrowserContext* context);
36 37
37 // BrowserContextKeyedAPI implementation. 38 // BrowserContextKeyedAPI implementation.
38 static BrowserContextKeyedAPIFactory<PowerApiManager>* GetFactoryInstance(); 39 static BrowserContextKeyedAPIFactory<PowerApiManager>* GetFactoryInstance();
39 40
40 // Adds an extension lock at |level| for |extension_id|, replacing the 41 // Adds an extension lock at |level| for |extension_id|, replacing the
41 // extension's existing lock, if any. 42 // extension's existing lock, if any.
42 void AddRequest(const std::string& extension_id, 43 void AddRequest(const std::string& extension_id,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // that has an outstanding request. 89 // that has an outstanding request.
89 typedef std::map<std::string, core_api::power::Level> ExtensionLevelMap; 90 typedef std::map<std::string, core_api::power::Level> ExtensionLevelMap;
90 ExtensionLevelMap extension_levels_; 91 ExtensionLevelMap extension_levels_;
91 92
92 DISALLOW_COPY_AND_ASSIGN(PowerApiManager); 93 DISALLOW_COPY_AND_ASSIGN(PowerApiManager);
93 }; 94 };
94 95
95 } // namespace extensions 96 } // namespace extensions
96 97
97 #endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_ 98 #endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_MANAGER_H_
OLDNEW
« no previous file with comments | « content/public/browser/power_save_blocker.h ('k') | extensions/browser/api/power/power_api_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698