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

Unified Diff: chrome/browser/background/background_contents_service.cc

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: tweaks Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/background/background_contents_service.cc
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index 3263305220191afaa31fe0bc9dd895ba778c9fa7..cf9071bbd5040d4839acb9219ad9ba3c70f84511 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
@@ -82,7 +83,8 @@ class CrashNotificationDelegate : public NotificationDelegate {
if (!service->GetAppBackgroundContents(ASCIIToUTF16(extension_id_)))
service->LoadBackgroundContentsForExtension(profile_, extension_id_);
} else {
- profile_->GetExtensionService()->ReloadExtension(extension_id_);
+ extensions::ExtensionSystem::Get(profile_)->extension_service()->
+ ReloadExtension(extension_id_);
}
// Closing the balloon here should be OK, but it causes a crash on Mac
@@ -250,7 +252,8 @@ void BackgroundContentsService::Observe(
content::Details<BackgroundContents>(details).ptr();
Profile* profile = content::Source<Profile>(source).ptr();
const string16& appid = GetParentApplicationId(bgcontents);
- ExtensionService* extension_service = profile->GetExtensionService();
+ ExtensionService* extension_service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
// extension_service can be NULL when running tests.
if (extension_service) {
const Extension* extension =
@@ -271,7 +274,8 @@ void BackgroundContentsService::Observe(
// app, then blow away registered urls in the pref.
ShutdownAssociatedBackgroundContents(ASCIIToUTF16(extension->id()));
- ExtensionService* service = profile->GetExtensionService();
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
if (service && service->is_ready()) {
// Now load the manifest-specified background page. If service isn't
// ready, then the background page will be loaded from the
@@ -297,7 +301,8 @@ void BackgroundContentsService::Observe(
BackgroundContentsServiceFactory::GetForProfile(profile)->
GetParentApplicationId(bg));
extension =
- profile->GetExtensionService()->GetExtensionById(extension_id, false);
+ extensions::ExtensionSystem::Get(profile)->extension_service()->
+ GetExtensionById(extension_id, false);
} else {
extensions::ExtensionHost* extension_host =
content::Details<extensions::ExtensionHost>(details).ptr();
@@ -369,7 +374,8 @@ void BackgroundContentsService::LoadBackgroundContentsFromPrefs(
prefs_->GetDictionary(prefs::kRegisteredBackgroundContents);
if (!contents)
return;
- ExtensionService* extensions_service = profile->GetExtensionService();
+ ExtensionService* extensions_service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
DCHECK(extensions_service);
for (DictionaryValue::key_iterator it = contents->begin_keys();
it != contents->end_keys(); ++it) {
@@ -404,7 +410,8 @@ void BackgroundContentsService::LoadBackgroundContentsForExtension(
const std::string& extension_id) {
// First look if the manifest specifies a background page.
const Extension* extension =
- profile->GetExtensionService()->GetExtensionById(extension_id, false);
+ extensions::ExtensionSystem::Get(profile)->extension_service()->
+ GetExtensionById(extension_id, false);
DCHECK(!extension || extension->is_hosted_app());
if (extension && extension->has_background_page()) {
LoadBackgroundContents(profile,
@@ -428,7 +435,8 @@ void BackgroundContentsService::LoadBackgroundContentsFromDictionary(
Profile* profile,
const std::string& extension_id,
const DictionaryValue* contents) {
- ExtensionService* extensions_service = profile->GetExtensionService();
+ ExtensionService* extensions_service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
DCHECK(extensions_service);
const DictionaryValue* dict;
@@ -448,8 +456,8 @@ void BackgroundContentsService::LoadBackgroundContentsFromDictionary(
void BackgroundContentsService::LoadBackgroundContentsFromManifests(
Profile* profile) {
- const ExtensionSet* extensions =
- profile->GetExtensionService()->extensions();
+ const ExtensionSet* extensions = extensions::ExtensionSystem::Get(profile)->
+ extension_service()->extensions();
ExtensionSet::const_iterator iter = extensions->begin();
for (; iter != extensions->end(); ++iter) {
const Extension* extension = *iter;

Powered by Google App Engine
This is Rietveld 408576698