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

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

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 7 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 #include "extensions/browser/api/power/power_api.h" 5 #include "extensions/browser/api/power/power_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "device/power_save_blocker/power_save_blocker.h" 10 #include "device/power_save_blocker/power_save_blocker.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 void PowerAPI::SetCreateBlockerFunctionForTesting( 83 void PowerAPI::SetCreateBlockerFunctionForTesting(
84 const CreateBlockerFunction& function) { 84 const CreateBlockerFunction& function) {
85 create_blocker_function_ = 85 create_blocker_function_ =
86 !function.is_null() ? function : base::Bind(&CreatePowerSaveBlocker); 86 !function.is_null() ? function : base::Bind(&CreatePowerSaveBlocker);
87 } 87 }
88 88
89 void PowerAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, 89 void PowerAPI::OnExtensionUnloaded(content::BrowserContext* browser_context,
90 const Extension* extension, 90 const Extension* extension,
91 UnloadedExtensionInfo::Reason reason) { 91 UnloadedExtensionReason reason) {
92 RemoveRequest(extension->id()); 92 RemoveRequest(extension->id());
93 UpdatePowerSaveBlocker(); 93 UpdatePowerSaveBlocker();
94 } 94 }
95 95
96 PowerAPI::PowerAPI(content::BrowserContext* context) 96 PowerAPI::PowerAPI(content::BrowserContext* context)
97 : browser_context_(context), 97 : browser_context_(context),
98 create_blocker_function_(base::Bind(&CreatePowerSaveBlocker)), 98 create_blocker_function_(base::Bind(&CreatePowerSaveBlocker)),
99 current_level_(api::power::LEVEL_SYSTEM) { 99 current_level_(api::power::LEVEL_SYSTEM) {
100 ExtensionRegistry::Get(browser_context_)->AddObserver(this); 100 ExtensionRegistry::Get(browser_context_)->AddObserver(this);
101 } 101 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 void PowerAPI::Shutdown() { 138 void PowerAPI::Shutdown() {
139 // Unregister here rather than in the d'tor; otherwise this call will recreate 139 // Unregister here rather than in the d'tor; otherwise this call will recreate
140 // the already-deleted ExtensionRegistry. 140 // the already-deleted ExtensionRegistry.
141 ExtensionRegistry::Get(browser_context_)->RemoveObserver(this); 141 ExtensionRegistry::Get(browser_context_)->RemoveObserver(this);
142 power_save_blocker_.reset(); 142 power_save_blocker_.reset();
143 } 143 }
144 144
145 } // namespace extensions 145 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/power/power_api.h ('k') | extensions/browser/api/power/power_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698