OLD | NEW |
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 extension_id, reason, base::Bind(&base::DoNothing), &error)) { | 239 extension_id, reason, base::Bind(&base::DoNothing), &error)) { |
240 LOG(WARNING) << "Cannot uninstall extension with id " << extension_id | 240 LOG(WARNING) << "Cannot uninstall extension with id " << extension_id |
241 << ": " << error; | 241 << ": " << error; |
242 return false; | 242 return false; |
243 } | 243 } |
244 | 244 |
245 return true; | 245 return true; |
246 } | 246 } |
247 | 247 |
248 ExtensionService::ExtensionService(Profile* profile, | 248 ExtensionService::ExtensionService(Profile* profile, |
249 const CommandLine* command_line, | 249 const base::CommandLine* command_line, |
250 const base::FilePath& install_directory, | 250 const base::FilePath& install_directory, |
251 extensions::ExtensionPrefs* extension_prefs, | 251 extensions::ExtensionPrefs* extension_prefs, |
252 extensions::Blacklist* blacklist, | 252 extensions::Blacklist* blacklist, |
253 bool autoupdate_enabled, | 253 bool autoupdate_enabled, |
254 bool extensions_enabled, | 254 bool extensions_enabled, |
255 extensions::OneShotEvent* ready) | 255 extensions::OneShotEvent* ready) |
256 : extensions::Blacklist::Observer(blacklist), | 256 : extensions::Blacklist::Observer(blacklist), |
257 profile_(profile), | 257 profile_(profile), |
258 system_(extensions::ExtensionSystem::Get(profile)), | 258 system_(extensions::ExtensionSystem::Get(profile)), |
259 extension_prefs_(extension_prefs), | 259 extension_prefs_(extension_prefs), |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 | 382 |
383 void ExtensionService::Init() { | 383 void ExtensionService::Init() { |
384 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 384 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
385 | 385 |
386 base::Time begin_time = base::Time::Now(); | 386 base::Time begin_time = base::Time::Now(); |
387 | 387 |
388 DCHECK(!is_ready()); // Can't redo init. | 388 DCHECK(!is_ready()); // Can't redo init. |
389 DCHECK_EQ(registry_->enabled_extensions().size(), 0u); | 389 DCHECK_EQ(registry_->enabled_extensions().size(), 0u); |
390 | 390 |
391 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 391 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
392 if (cmd_line->HasSwitch(switches::kInstallEphemeralAppFromWebstore)) { | 392 if (cmd_line->HasSwitch(switches::kInstallEphemeralAppFromWebstore)) { |
393 // The sole purpose of this launch is to install a new extension from CWS | 393 // The sole purpose of this launch is to install a new extension from CWS |
394 // and immediately terminate: loading already installed extensions is | 394 // and immediately terminate: loading already installed extensions is |
395 // unnecessary and may interfere with the inline install dialog (e.g. if an | 395 // unnecessary and may interfere with the inline install dialog (e.g. if an |
396 // extension listens to onStartup and opens a window). | 396 // extension listens to onStartup and opens a window). |
397 SetReadyAndNotifyListeners(); | 397 SetReadyAndNotifyListeners(); |
398 } else { | 398 } else { |
399 // LoadAllExtensions() calls OnLoadedInstalledExtensions(). | 399 // LoadAllExtensions() calls OnLoadedInstalledExtensions(). |
400 component_loader_->LoadAll(); | 400 component_loader_->LoadAll(); |
401 extensions::InstalledLoader(this).LoadAllExtensions(); | 401 extensions::InstalledLoader(this).LoadAllExtensions(); |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 } | 2529 } |
2530 | 2530 |
2531 void ExtensionService::OnProfileDestructionStarted() { | 2531 void ExtensionService::OnProfileDestructionStarted() { |
2532 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2532 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2533 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2533 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2534 it != ids_to_unload.end(); | 2534 it != ids_to_unload.end(); |
2535 ++it) { | 2535 ++it) { |
2536 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2536 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2537 } | 2537 } |
2538 } | 2538 } |
OLD | NEW |