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

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

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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_H_ 5 #ifndef EXTENSIONS_BROWSER_API_POWER_POWER_API_H_
6 #define EXTENSIONS_BROWSER_API_POWER_POWER_API_H_ 6 #define EXTENSIONS_BROWSER_API_POWER_POWER_API_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 content::PowerSaveBlocker::Reason, 57 content::PowerSaveBlocker::Reason,
58 const std::string&)> CreateBlockerFunction; 58 const std::string&)> CreateBlockerFunction;
59 59
60 static PowerAPI* Get(content::BrowserContext* context); 60 static PowerAPI* Get(content::BrowserContext* context);
61 61
62 // BrowserContextKeyedAPI implementation. 62 // BrowserContextKeyedAPI implementation.
63 static BrowserContextKeyedAPIFactory<PowerAPI>* GetFactoryInstance(); 63 static BrowserContextKeyedAPIFactory<PowerAPI>* GetFactoryInstance();
64 64
65 // Adds an extension lock at |level| for |extension_id|, replacing the 65 // Adds an extension lock at |level| for |extension_id|, replacing the
66 // extension's existing lock, if any. 66 // extension's existing lock, if any.
67 void AddRequest(const std::string& extension_id, 67 void AddRequest(const std::string& extension_id, api::power::Level level);
68 core_api::power::Level level);
69 68
70 // Removes an extension lock for an extension. Calling this for an 69 // Removes an extension lock for an extension. Calling this for an
71 // extension id without a lock will do nothing. 70 // extension id without a lock will do nothing.
72 void RemoveRequest(const std::string& extension_id); 71 void RemoveRequest(const std::string& extension_id);
73 72
74 // Replaces the function that will be called to create PowerSaveBlocker 73 // Replaces the function that will be called to create PowerSaveBlocker
75 // objects. Passing an empty callback will revert to the default. 74 // objects. Passing an empty callback will revert to the default.
76 void SetCreateBlockerFunctionForTesting(CreateBlockerFunction function); 75 void SetCreateBlockerFunctionForTesting(CreateBlockerFunction function);
77 76
78 // Overridden from extensions::ExtensionRegistryObserver. 77 // Overridden from extensions::ExtensionRegistryObserver.
(...skipping 21 matching lines...) Expand all
100 99
101 // Function that should be called to create PowerSaveBlocker objects. 100 // Function that should be called to create PowerSaveBlocker objects.
102 // Tests can change this to record what would've been done instead of 101 // Tests can change this to record what would've been done instead of
103 // actually changing the system power-saving settings. 102 // actually changing the system power-saving settings.
104 CreateBlockerFunction create_blocker_function_; 103 CreateBlockerFunction create_blocker_function_;
105 104
106 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; 105 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_;
107 106
108 // Current level used by |power_save_blocker_|. Meaningless if 107 // Current level used by |power_save_blocker_|. Meaningless if
109 // |power_save_blocker_| is NULL. 108 // |power_save_blocker_| is NULL.
110 core_api::power::Level current_level_; 109 api::power::Level current_level_;
111 110
112 // Map from extension ID to the corresponding level for each extension 111 // Map from extension ID to the corresponding level for each extension
113 // that has an outstanding request. 112 // that has an outstanding request.
114 typedef std::map<std::string, core_api::power::Level> ExtensionLevelMap; 113 typedef std::map<std::string, api::power::Level> ExtensionLevelMap;
115 ExtensionLevelMap extension_levels_; 114 ExtensionLevelMap extension_levels_;
116 115
117 DISALLOW_COPY_AND_ASSIGN(PowerAPI); 116 DISALLOW_COPY_AND_ASSIGN(PowerAPI);
118 }; 117 };
119 118
120 } // namespace extensions 119 } // namespace extensions
121 120
122 #endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_H_ 121 #endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698