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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "chrome/common/extensions/extension_messages.h" 84 #include "chrome/common/extensions/extension_messages.h"
85 #include "chrome/common/extensions/extension_resource.h" 85 #include "chrome/common/extensions/extension_resource.h"
86 #include "chrome/common/pref_names.h" 86 #include "chrome/common/pref_names.h"
87 #include "chrome/common/url_constants.h" 87 #include "chrome/common/url_constants.h"
88 #include "content/browser/browser_thread.h" 88 #include "content/browser/browser_thread.h"
89 #include "content/browser/debugger/devtools_manager.h" 89 #include "content/browser/debugger/devtools_manager.h"
90 #include "content/browser/plugin_process_host.h" 90 #include "content/browser/plugin_process_host.h"
91 #include "content/browser/plugin_service.h" 91 #include "content/browser/plugin_service.h"
92 #include "content/browser/renderer_host/render_process_host.h" 92 #include "content/browser/renderer_host/render_process_host.h"
93 #include "content/browser/user_metrics.h" 93 #include "content/browser/user_metrics.h"
94 #include "content/common/notification_service.h" 94 #include "content/public/browser/notification_service.h"
95 #include "content/common/pepper_plugin_registry.h" 95 #include "content/common/pepper_plugin_registry.h"
96 #include "content/public/browser/notification_types.h" 96 #include "content/public/browser/notification_types.h"
97 #include "googleurl/src/gurl.h" 97 #include "googleurl/src/gurl.h"
98 #include "net/base/registry_controlled_domain.h" 98 #include "net/base/registry_controlled_domain.h"
99 #include "webkit/database/database_tracker.h" 99 #include "webkit/database/database_tracker.h"
100 #include "webkit/database/database_util.h" 100 #include "webkit/database/database_util.h"
101 #include "webkit/plugins/npapi/plugin_list.h" 101 #include "webkit/plugins/npapi/plugin_list.h"
102 102
103 #if defined(OS_CHROMEOS) 103 #if defined(OS_CHROMEOS)
104 #include "chrome/browser/chromeos/cros/cros_library.h" 104 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 609 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
610 610
611 // Figure out if extension installation should be enabled. 611 // Figure out if extension installation should be enabled.
612 if (command_line->HasSwitch(switches::kDisableExtensions)) { 612 if (command_line->HasSwitch(switches::kDisableExtensions)) {
613 extensions_enabled_ = false; 613 extensions_enabled_ = false;
614 } else if (profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { 614 } else if (profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) {
615 extensions_enabled_ = false; 615 extensions_enabled_ = false;
616 } 616 }
617 617
618 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 618 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
619 NotificationService::AllBrowserContextsAndSources()); 619 content::NotificationService::AllBrowserContextsAndSources());
620 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, 620 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
621 NotificationService::AllBrowserContextsAndSources()); 621 content::NotificationService::AllBrowserContextsAndSources());
622 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 622 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
623 NotificationService::AllBrowserContextsAndSources()); 623 content::NotificationService::AllBrowserContextsAndSources());
624 pref_change_registrar_.Init(profile->GetPrefs()); 624 pref_change_registrar_.Init(profile->GetPrefs());
625 pref_change_registrar_.Add(prefs::kExtensionInstallAllowList, this); 625 pref_change_registrar_.Add(prefs::kExtensionInstallAllowList, this);
626 pref_change_registrar_.Add(prefs::kExtensionInstallDenyList, this); 626 pref_change_registrar_.Add(prefs::kExtensionInstallDenyList, this);
627 627
628 // Set up the ExtensionUpdater 628 // Set up the ExtensionUpdater
629 if (autoupdate_enabled) { 629 if (autoupdate_enabled) {
630 int update_frequency = kDefaultUpdateFrequencySeconds; 630 int update_frequency = kDefaultUpdateFrequencySeconds;
631 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { 631 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) {
632 base::StringToInt(command_line->GetSwitchValueASCII( 632 base::StringToInt(command_line->GetSwitchValueASCII(
633 switches::kExtensionsUpdateFrequency), 633 switches::kExtensionsUpdateFrequency),
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 scoped_refptr<const Extension> extension(GetInstalledExtension(extension_id)); 884 scoped_refptr<const Extension> extension(GetInstalledExtension(extension_id));
885 885
886 // Callers should not send us nonexistent extensions. 886 // Callers should not send us nonexistent extensions.
887 CHECK(extension); 887 CHECK(extension);
888 888
889 // Policy change which triggers an uninstall will always set 889 // Policy change which triggers an uninstall will always set
890 // |external_uninstall| to true so this is the only way to uninstall 890 // |external_uninstall| to true so this is the only way to uninstall
891 // managed extensions. 891 // managed extensions.
892 if (!Extension::UserMayDisable(extension->location()) && 892 if (!Extension::UserMayDisable(extension->location()) &&
893 !external_uninstall) { 893 !external_uninstall) {
894 NotificationService::current()->Notify( 894 content::NotificationService::current()->Notify(
895 chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, 895 chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED,
896 content::Source<Profile>(profile_), 896 content::Source<Profile>(profile_),
897 content::Details<const Extension>(extension)); 897 content::Details<const Extension>(extension));
898 if (error != NULL) { 898 if (error != NULL) {
899 *error = errors::kCannotUninstallManagedExtension; 899 *error = errors::kCannotUninstallManagedExtension;
900 } 900 }
901 return false; 901 return false;
902 } 902 }
903 903
904 // Extract the data we need for sync now, but don't actually sync until we've 904 // Extract the data we need for sync now, but don't actually sync until we've
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 IsStorageProtected(launch_web_url_origin)) { 952 IsStorageProtected(launch_web_url_origin)) {
953 ExtensionDataDeleter::StartDeleting( 953 ExtensionDataDeleter::StartDeleting(
954 profile_, extension_id, launch_web_url_origin, is_storage_isolated); 954 profile_, extension_id, launch_web_url_origin, is_storage_isolated);
955 } 955 }
956 ExtensionDataDeleter::StartDeleting( 956 ExtensionDataDeleter::StartDeleting(
957 profile_, extension_id, extension->url(), is_storage_isolated); 957 profile_, extension_id, extension->url(), is_storage_isolated);
958 958
959 UntrackTerminatedExtension(extension_id); 959 UntrackTerminatedExtension(extension_id);
960 960
961 // Notify interested parties that we've uninstalled this extension. 961 // Notify interested parties that we've uninstalled this extension.
962 NotificationService::current()->Notify( 962 content::NotificationService::current()->Notify(
963 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 963 chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
964 content::Source<Profile>(profile_), 964 content::Source<Profile>(profile_),
965 content::Details<const std::string>(&extension_id)); 965 content::Details<const std::string>(&extension_id));
966 966
967 if (sync_bundle && sync_bundle->HasExtensionId(extension_id)) { 967 if (sync_bundle && sync_bundle->HasExtensionId(extension_id)) {
968 sync_bundle->sync_processor->ProcessSyncChanges( 968 sync_bundle->sync_processor->ProcessSyncChanges(
969 FROM_HERE, SyncChangeList(1, sync_change)); 969 FROM_HERE, SyncChangeList(1, sync_change));
970 sync_bundle->synced_extensions.erase(extension_id); 970 sync_bundle->synced_extensions.erase(extension_id);
971 } 971 }
972 972
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 // The ChromeURLRequestContexts need to be first to know that the extension 1466 // The ChromeURLRequestContexts need to be first to know that the extension
1467 // was loaded, otherwise a race can arise where a renderer that is created 1467 // was loaded, otherwise a race can arise where a renderer that is created
1468 // for the extension may try to load an extension URL with an extension id 1468 // for the extension may try to load an extension URL with an extension id
1469 // that the request context doesn't yet know about. The profile is responsible 1469 // that the request context doesn't yet know about. The profile is responsible
1470 // for ensuring its URLRequestContexts appropriately discover the loaded 1470 // for ensuring its URLRequestContexts appropriately discover the loaded
1471 // extension. 1471 // extension.
1472 profile_->RegisterExtensionWithRequestContexts(extension); 1472 profile_->RegisterExtensionWithRequestContexts(extension);
1473 1473
1474 // Tell subsystems that use the EXTENSION_LOADED notification about the new 1474 // Tell subsystems that use the EXTENSION_LOADED notification about the new
1475 // extension. 1475 // extension.
1476 NotificationService::current()->Notify( 1476 content::NotificationService::current()->Notify(
1477 chrome::NOTIFICATION_EXTENSION_LOADED, 1477 chrome::NOTIFICATION_EXTENSION_LOADED,
1478 content::Source<Profile>(profile_), 1478 content::Source<Profile>(profile_),
1479 content::Details<const Extension>(extension)); 1479 content::Details<const Extension>(extension));
1480 1480
1481 // Tell renderers about the new extension. 1481 // Tell renderers about the new extension.
1482 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); 1482 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
1483 !i.IsAtEnd(); i.Advance()) { 1483 !i.IsAtEnd(); i.Advance()) {
1484 RenderProcessHost* host = i.GetCurrentValue(); 1484 RenderProcessHost* host = i.GetCurrentValue();
1485 Profile* host_profile = 1485 Profile* host_profile =
1486 Profile::FromBrowserContext(host->browser_context()); 1486 Profile::FromBrowserContext(host->browser_context());
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 } 1580 }
1581 #endif 1581 #endif
1582 } 1582 }
1583 #endif 1583 #endif
1584 } 1584 }
1585 1585
1586 void ExtensionService::NotifyExtensionUnloaded( 1586 void ExtensionService::NotifyExtensionUnloaded(
1587 const Extension* extension, 1587 const Extension* extension,
1588 extension_misc::UnloadedExtensionReason reason) { 1588 extension_misc::UnloadedExtensionReason reason) {
1589 UnloadedExtensionInfo details(extension, reason); 1589 UnloadedExtensionInfo details(extension, reason);
1590 NotificationService::current()->Notify( 1590 content::NotificationService::current()->Notify(
1591 chrome::NOTIFICATION_EXTENSION_UNLOADED, 1591 chrome::NOTIFICATION_EXTENSION_UNLOADED,
1592 content::Source<Profile>(profile_), 1592 content::Source<Profile>(profile_),
1593 content::Details<UnloadedExtensionInfo>(&details)); 1593 content::Details<UnloadedExtensionInfo>(&details));
1594 1594
1595 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); 1595 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
1596 !i.IsAtEnd(); i.Advance()) { 1596 !i.IsAtEnd(); i.Advance()) {
1597 RenderProcessHost* host = i.GetCurrentValue(); 1597 RenderProcessHost* host = i.GetCurrentValue();
1598 Profile* host_profile = 1598 Profile* host_profile =
1599 Profile::FromBrowserContext(host->browser_context()); 1599 Profile::FromBrowserContext(host->browser_context());
1600 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) 1600 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile())
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 // Clean up runtime data. 2270 // Clean up runtime data.
2271 extension_runtime_data_.erase(extension_id); 2271 extension_runtime_data_.erase(extension_id);
2272 2272
2273 ExtensionList::iterator iter = std::find(disabled_extensions_.begin(), 2273 ExtensionList::iterator iter = std::find(disabled_extensions_.begin(),
2274 disabled_extensions_.end(), 2274 disabled_extensions_.end(),
2275 extension.get()); 2275 extension.get());
2276 if (iter != disabled_extensions_.end()) { 2276 if (iter != disabled_extensions_.end()) {
2277 UnloadedExtensionInfo details(extension, reason); 2277 UnloadedExtensionInfo details(extension, reason);
2278 details.already_disabled = true; 2278 details.already_disabled = true;
2279 disabled_extensions_.erase(iter); 2279 disabled_extensions_.erase(iter);
2280 NotificationService::current()->Notify( 2280 content::NotificationService::current()->Notify(
2281 chrome::NOTIFICATION_EXTENSION_UNLOADED, 2281 chrome::NOTIFICATION_EXTENSION_UNLOADED,
2282 content::Source<Profile>(profile_), 2282 content::Source<Profile>(profile_),
2283 content::Details<UnloadedExtensionInfo>(&details)); 2283 content::Details<UnloadedExtensionInfo>(&details));
2284 // Make sure the profile cleans up its RequestContexts when an already 2284 // Make sure the profile cleans up its RequestContexts when an already
2285 // disabled extension is unloaded (since they are also tracking the disabled 2285 // disabled extension is unloaded (since they are also tracking the disabled
2286 // extensions). 2286 // extensions).
2287 profile_->UnregisterExtensionWithRequestContexts(extension_id, reason); 2287 profile_->UnregisterExtensionWithRequestContexts(extension_id, reason);
2288 return; 2288 return;
2289 } 2289 }
2290 2290
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 ThemeServiceFactory::GetForProfile(profile_)->RemoveUnusedThemes(); 2342 ThemeServiceFactory::GetForProfile(profile_)->RemoveUnusedThemes();
2343 } 2343 }
2344 } 2344 }
2345 2345
2346 void ExtensionService::OnLoadedInstalledExtensions() { 2346 void ExtensionService::OnLoadedInstalledExtensions() {
2347 if (updater_.get()) { 2347 if (updater_.get()) {
2348 updater_->Start(); 2348 updater_->Start();
2349 } 2349 }
2350 2350
2351 ready_ = true; 2351 ready_ = true;
2352 NotificationService::current()->Notify( 2352 content::NotificationService::current()->Notify(
2353 chrome::NOTIFICATION_EXTENSIONS_READY, 2353 chrome::NOTIFICATION_EXTENSIONS_READY,
2354 content::Source<Profile>(profile_), 2354 content::Source<Profile>(profile_),
2355 NotificationService::NoDetails()); 2355 content::NotificationService::NoDetails());
2356 } 2356 }
2357 2357
2358 void ExtensionService::AddExtension(const Extension* extension) { 2358 void ExtensionService::AddExtension(const Extension* extension) {
2359 // Ensure extension is deleted unless we transfer ownership. 2359 // Ensure extension is deleted unless we transfer ownership.
2360 scoped_refptr<const Extension> scoped_extension(extension); 2360 scoped_refptr<const Extension> scoped_extension(extension);
2361 2361
2362 // TODO(jstritar): We may be able to get rid of this branch by overriding the 2362 // TODO(jstritar): We may be able to get rid of this branch by overriding the
2363 // default extension state to DISABLED when the --disable-extensions flag 2363 // default extension state to DISABLED when the --disable-extensions flag
2364 // is set (http://crbug.com/29067). 2364 // is set (http://crbug.com/29067).
2365 if (!extensions_enabled() && 2365 if (!extensions_enabled() &&
(...skipping 17 matching lines...) Expand all
2383 // Check if the extension's privileges have changed and disable the 2383 // Check if the extension's privileges have changed and disable the
2384 // extension if necessary. 2384 // extension if necessary.
2385 InitializePermissions(extension); 2385 InitializePermissions(extension);
2386 2386
2387 bool disabled = extension_prefs_->IsExtensionDisabled(extension->id()); 2387 bool disabled = extension_prefs_->IsExtensionDisabled(extension->id());
2388 if (disabled) { 2388 if (disabled) {
2389 disabled_extensions_.push_back(scoped_extension); 2389 disabled_extensions_.push_back(scoped_extension);
2390 // TODO(aa): This seems dodgy. It seems that AddExtension() could get called 2390 // TODO(aa): This seems dodgy. It seems that AddExtension() could get called
2391 // with a disabled extension for other reasons other than that an update was 2391 // with a disabled extension for other reasons other than that an update was
2392 // disabled. 2392 // disabled.
2393 NotificationService::current()->Notify( 2393 content::NotificationService::current()->Notify(
2394 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 2394 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
2395 content::Source<Profile>(profile_), 2395 content::Source<Profile>(profile_),
2396 content::Details<const Extension>(extension)); 2396 content::Details<const Extension>(extension));
2397 SyncExtensionChangeIfNeeded(*extension); 2397 SyncExtensionChangeIfNeeded(*extension);
2398 return; 2398 return;
2399 } 2399 }
2400 2400
2401 extensions_.push_back(scoped_extension); 2401 extensions_.push_back(scoped_extension);
2402 SyncExtensionChangeIfNeeded(*extension); 2402 SyncExtensionChangeIfNeeded(*extension);
2403 NotifyExtensionLoaded(extension); 2403 NotifyExtensionLoaded(extension);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 if (pending_extension_manager()->GetById(id, &pending_extension_info)) { 2551 if (pending_extension_manager()->GetById(id, &pending_extension_info)) {
2552 pending_extension_manager()->Remove(id); 2552 pending_extension_manager()->Remove(id);
2553 2553
2554 if (!pending_extension_info.ShouldAllowInstall(*extension)) { 2554 if (!pending_extension_info.ShouldAllowInstall(*extension)) {
2555 LOG(WARNING) 2555 LOG(WARNING)
2556 << "ShouldAllowInstall() returned false for " 2556 << "ShouldAllowInstall() returned false for "
2557 << id << " of type " << extension->GetType() 2557 << id << " of type " << extension->GetType()
2558 << " and update URL " << extension->update_url().spec() 2558 << " and update URL " << extension->update_url().spec()
2559 << "; not installing"; 2559 << "; not installing";
2560 2560
2561 NotificationService::current()->Notify( 2561 content::NotificationService::current()->Notify(
2562 chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, 2562 chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED,
2563 content::Source<Profile>(profile_), 2563 content::Source<Profile>(profile_),
2564 content::Details<const Extension>(extension)); 2564 content::Details<const Extension>(extension));
2565 2565
2566 // Delete the extension directory since we're not going to 2566 // Delete the extension directory since we're not going to
2567 // load it. 2567 // load it.
2568 if (!BrowserThread::PostTask( 2568 if (!BrowserThread::PostTask(
2569 BrowserThread::FILE, FROM_HERE, 2569 BrowserThread::FILE, FROM_HERE,
2570 base::Bind(&extension_file_util::DeleteFile, 2570 base::Bind(&extension_file_util::DeleteFile,
2571 extension->path(), true))) 2571 extension->path(), true)))
(...skipping 30 matching lines...) Expand all
2602 !extension_prefs_->HasAllowFileAccessSetting(id)) { 2602 !extension_prefs_->HasAllowFileAccessSetting(id)) {
2603 extension_prefs_->SetAllowFileAccess(id, true); 2603 extension_prefs_->SetAllowFileAccess(id, true);
2604 } 2604 }
2605 2605
2606 // If the extension should automatically block network startup (e.g., it uses 2606 // If the extension should automatically block network startup (e.g., it uses
2607 // the webRequest API), set the preference. Otherwise clear it, in case the 2607 // the webRequest API), set the preference. Otherwise clear it, in case the
2608 // extension stopped using a relevant API. 2608 // extension stopped using a relevant API.
2609 extension_prefs_->SetDelaysNetworkRequests( 2609 extension_prefs_->SetDelaysNetworkRequests(
2610 extension->id(), extension->ImplicitlyDelaysNetworkStartup()); 2610 extension->id(), extension->ImplicitlyDelaysNetworkStartup());
2611 2611
2612 NotificationService::current()->Notify( 2612 content::NotificationService::current()->Notify(
2613 chrome::NOTIFICATION_EXTENSION_INSTALLED, 2613 chrome::NOTIFICATION_EXTENSION_INSTALLED,
2614 content::Source<Profile>(profile_), 2614 content::Source<Profile>(profile_),
2615 content::Details<const Extension>(extension)); 2615 content::Details<const Extension>(extension));
2616 2616
2617 // Transfer ownership of |extension| to AddExtension. 2617 // Transfer ownership of |extension| to AddExtension.
2618 AddExtension(scoped_extension); 2618 AddExtension(scoped_extension);
2619 } 2619 }
2620 2620
2621 const Extension* ExtensionService::GetExtensionByIdInternal( 2621 const Extension* ExtensionService::GetExtensionByIdInternal(
2622 const std::string& id, bool include_enabled, bool include_disabled, 2622 const std::string& id, bool include_enabled, bool include_disabled,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 installer->set_expected_id(id); 2776 installer->set_expected_id(id);
2777 installer->set_expected_version(*version); 2777 installer->set_expected_version(*version);
2778 installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE); 2778 installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE);
2779 installer->InstallCrx(path); 2779 installer->InstallCrx(path);
2780 } 2780 }
2781 2781
2782 void ExtensionService::ReportExtensionLoadError( 2782 void ExtensionService::ReportExtensionLoadError(
2783 const FilePath& extension_path, 2783 const FilePath& extension_path,
2784 const std::string &error, 2784 const std::string &error,
2785 bool be_noisy) { 2785 bool be_noisy) {
2786 NotificationService* service = NotificationService::current(); 2786 content::NotificationService* service =
2787 content::NotificationService::current();
2787 service->Notify(chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, 2788 service->Notify(chrome::NOTIFICATION_EXTENSION_LOAD_ERROR,
2788 content::Source<Profile>(profile_), 2789 content::Source<Profile>(profile_),
2789 content::Details<const std::string>(&error)); 2790 content::Details<const std::string>(&error));
2790 2791
2791 std::string path_str = UTF16ToUTF8(extension_path.LossyDisplayName()); 2792 std::string path_str = UTF16ToUTF8(extension_path.LossyDisplayName());
2792 std::string message = base::StringPrintf( 2793 std::string message = base::StringPrintf(
2793 "Could not load extension from '%s'. %s", 2794 "Could not load extension from '%s'. %s",
2794 path_str.c_str(), error.c_str()); 2795 path_str.c_str(), error.c_str());
2795 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy); 2796 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy);
2796 } 2797 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 } 2912 }
2912 2913
2913 bool ExtensionService::IsBackgroundPageReady(const Extension* extension) { 2914 bool ExtensionService::IsBackgroundPageReady(const Extension* extension) {
2914 return (extension->background_url().is_empty() || 2915 return (extension->background_url().is_empty() ||
2915 extension_runtime_data_[extension->id()].background_page_ready); 2916 extension_runtime_data_[extension->id()].background_page_ready);
2916 } 2917 }
2917 2918
2918 void ExtensionService::SetBackgroundPageReady(const Extension* extension) { 2919 void ExtensionService::SetBackgroundPageReady(const Extension* extension) {
2919 DCHECK(!extension->background_url().is_empty()); 2920 DCHECK(!extension->background_url().is_empty());
2920 extension_runtime_data_[extension->id()].background_page_ready = true; 2921 extension_runtime_data_[extension->id()].background_page_ready = true;
2921 NotificationService::current()->Notify( 2922 content::NotificationService::current()->Notify(
2922 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, 2923 chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
2923 content::Source<const Extension>(extension), 2924 content::Source<const Extension>(extension),
2924 NotificationService::NoDetails()); 2925 content::NotificationService::NoDetails());
2925 } 2926 }
2926 2927
2927 bool ExtensionService::IsBeingUpgraded(const Extension* extension) { 2928 bool ExtensionService::IsBeingUpgraded(const Extension* extension) {
2928 return extension_runtime_data_[extension->id()].being_upgraded; 2929 return extension_runtime_data_[extension->id()].being_upgraded;
2929 } 2930 }
2930 2931
2931 void ExtensionService::SetBeingUpgraded(const Extension* extension, 2932 void ExtensionService::SetBeingUpgraded(const Extension* extension,
2932 bool value) { 2933 bool value) {
2933 extension_runtime_data_[extension->id()].being_upgraded = value; 2934 extension_runtime_data_[extension->id()].being_upgraded = value;
2934 } 2935 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3006 3007
3007 ExtensionService::NaClModuleInfoList::iterator 3008 ExtensionService::NaClModuleInfoList::iterator
3008 ExtensionService::FindNaClModule(const GURL& url) { 3009 ExtensionService::FindNaClModule(const GURL& url) {
3009 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 3010 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
3010 iter != nacl_module_list_.end(); ++iter) { 3011 iter != nacl_module_list_.end(); ++iter) {
3011 if (iter->url == url) 3012 if (iter->url == url)
3012 return iter; 3013 return iter;
3013 } 3014 }
3014 return nacl_module_list_.end(); 3015 return nacl_module_list_.end();
3015 } 3016 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_save_page_api.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698