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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 381283002: Refactor code that defers extension background page loading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: larger DeferLoadingBackgroundHosts Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 install_directory_(install_directory), 276 install_directory_(install_directory),
277 extensions_enabled_(extensions_enabled), 277 extensions_enabled_(extensions_enabled),
278 show_extensions_prompts_(true), 278 show_extensions_prompts_(true),
279 install_updates_when_idle_(true), 279 install_updates_when_idle_(true),
280 ready_(ready), 280 ready_(ready),
281 update_once_all_providers_are_ready_(false), 281 update_once_all_providers_are_ready_(false),
282 browser_terminating_(false), 282 browser_terminating_(false),
283 installs_delayed_for_gc_(false), 283 installs_delayed_for_gc_(false),
284 is_first_run_(false), 284 is_first_run_(false),
285 shared_module_service_(new extensions::SharedModuleService(profile_)) { 285 shared_module_service_(new extensions::SharedModuleService(profile_)) {
286 LOG(ERROR) << "JAMES new ExtensionService";
286 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 287 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
287 288
288 // Figure out if extension installation should be enabled. 289 // Figure out if extension installation should be enabled.
289 if (extensions::ExtensionsBrowserClient::Get()->AreExtensionsDisabled( 290 if (extensions::ExtensionsBrowserClient::Get()->AreExtensionsDisabled(
290 *command_line, profile)) 291 *command_line, profile))
291 extensions_enabled_ = false; 292 extensions_enabled_ = false;
292 293
293 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, 294 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
294 content::NotificationService::AllBrowserContextsAndSources()); 295 content::NotificationService::AllBrowserContextsAndSources());
295 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 296 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 // Calling UnloadAllExtensionsForTest here triggers a false-positive presubmit 1320 // Calling UnloadAllExtensionsForTest here triggers a false-positive presubmit
1320 // warning about calling test code in production. 1321 // warning about calling test code in production.
1321 UnloadAllExtensionsInternal(); 1322 UnloadAllExtensionsInternal();
1322 component_loader_->LoadAll(); 1323 component_loader_->LoadAll();
1323 extensions::InstalledLoader(this).LoadAllExtensions(); 1324 extensions::InstalledLoader(this).LoadAllExtensions();
1324 // Don't call SetReadyAndNotifyListeners() since tests call this multiple 1325 // Don't call SetReadyAndNotifyListeners() since tests call this multiple
1325 // times. 1326 // times.
1326 } 1327 }
1327 1328
1328 void ExtensionService::SetReadyAndNotifyListeners() { 1329 void ExtensionService::SetReadyAndNotifyListeners() {
1330 LOG(ERROR) << "JAMES send extensions_ready";
1329 ready_->Signal(); 1331 ready_->Signal();
1330 content::NotificationService::current()->Notify( 1332 content::NotificationService::current()->Notify(
1331 chrome::NOTIFICATION_EXTENSIONS_READY, 1333 chrome::NOTIFICATION_EXTENSIONS_READY,
1332 content::Source<Profile>(profile_), 1334 content::Source<Profile>(profile_),
1333 content::NotificationService::NoDetails()); 1335 content::NotificationService::NoDetails());
1334 } 1336 }
1335 1337
1336 void ExtensionService::OnLoadedInstalledExtensions() { 1338 void ExtensionService::OnLoadedInstalledExtensions() {
1337 #if defined(ENABLE_EXTENSIONS) 1339 #if defined(ENABLE_EXTENSIONS)
1338 if (updater_) 1340 if (updater_)
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 } 2348 }
2347 2349
2348 void ExtensionService::OnProfileDestructionStarted() { 2350 void ExtensionService::OnProfileDestructionStarted() {
2349 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2351 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2350 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2352 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2351 it != ids_to_unload.end(); 2353 it != ids_to_unload.end();
2352 ++it) { 2354 ++it) {
2353 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2355 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2354 } 2356 }
2355 } 2357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698