| OLD | NEW |
| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void RemoveRequest(const std::string& extension_id); | 82 void RemoveRequest(const std::string& extension_id); |
| 83 | 83 |
| 84 // Replaces the function that will be called to create PowerSaveBlocker | 84 // Replaces the function that will be called to create PowerSaveBlocker |
| 85 // objects. Passing an empty callback will revert to the default. | 85 // objects. Passing an empty callback will revert to the default. |
| 86 void SetCreateBlockerFunctionForTesting( | 86 void SetCreateBlockerFunctionForTesting( |
| 87 const CreateBlockerFunction& function); | 87 const CreateBlockerFunction& function); |
| 88 | 88 |
| 89 // Overridden from extensions::ExtensionRegistryObserver. | 89 // Overridden from extensions::ExtensionRegistryObserver. |
| 90 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 90 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 91 const Extension* extension, | 91 const Extension* extension, |
| 92 UnloadedExtensionInfo::Reason reason) override; | 92 UnloadedExtensionReason reason) override; |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 friend class BrowserContextKeyedAPIFactory<PowerAPI>; | 95 friend class BrowserContextKeyedAPIFactory<PowerAPI>; |
| 96 | 96 |
| 97 explicit PowerAPI(content::BrowserContext* context); | 97 explicit PowerAPI(content::BrowserContext* context); |
| 98 ~PowerAPI() override; | 98 ~PowerAPI() override; |
| 99 | 99 |
| 100 // Updates |power_save_blocker_| and |current_level_| after iterating | 100 // Updates |power_save_blocker_| and |current_level_| after iterating |
| 101 // over |extension_levels_|. | 101 // over |extension_levels_|. |
| 102 void UpdatePowerSaveBlocker(); | 102 void UpdatePowerSaveBlocker(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 122 | 122 |
| 123 // Outstanding requests. | 123 // Outstanding requests. |
| 124 ExtensionLevelMap extension_levels_; | 124 ExtensionLevelMap extension_levels_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(PowerAPI); | 126 DISALLOW_COPY_AND_ASSIGN(PowerAPI); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace extensions | 129 } // namespace extensions |
| 130 | 130 |
| 131 #endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_H_ | 131 #endif // EXTENSIONS_BROWSER_API_POWER_POWER_API_H_ |
| OLD | NEW |