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

Unified Diff: apps/app_load_service.cc

Issue 2729503007: Remove Profile usage from //apps (Closed)
Patch Set: deps Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/app_load_service.h ('k') | apps/app_load_service_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_load_service.cc
diff --git a/apps/app_load_service.cc b/apps/app_load_service.cc
index ea706f43d8061e05163bb1f8d49e501be8bd6b4b..38b6c6511762cc266bb8e76f083cc92a972b8b92 100644
--- a/apps/app_load_service.cc
+++ b/apps/app_load_service.cc
@@ -9,7 +9,7 @@
#include "apps/launcher.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/unpacked_installer.h"
-#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -32,31 +32,31 @@ AppLoadService::PostReloadAction::PostReloadAction()
command_line(base::CommandLine::NO_PROGRAM) {
}
-AppLoadService::AppLoadService(Profile* profile)
- : profile_(profile) {
+AppLoadService::AppLoadService(content::BrowserContext* context)
+ : context_(context) {
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD,
content::NotificationService::AllSources());
- extensions::ExtensionRegistry::Get(profile_)->AddObserver(this);
+ extensions::ExtensionRegistry::Get(context_)->AddObserver(this);
}
AppLoadService::~AppLoadService() = default;
void AppLoadService::Shutdown() {
- extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this);
+ extensions::ExtensionRegistry::Get(context_)->RemoveObserver(this);
}
void AppLoadService::RestartApplication(const std::string& extension_id) {
post_reload_actions_[extension_id].action_type = RESTART;
- ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->
- extension_service();
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(context_)->extension_service();
DCHECK(service);
service->ReloadExtension(extension_id);
}
void AppLoadService::RestartApplicationIfRunning(
const std::string& extension_id) {
- if (apps::AppRestoreService::Get(profile_)->IsAppRestorable(extension_id))
+ if (apps::AppRestoreService::Get(context_)->IsAppRestorable(extension_id))
RestartApplication(extension_id);
}
@@ -64,7 +64,7 @@ bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path,
const base::CommandLine& command_line,
const base::FilePath& current_dir) {
ExtensionService* extension_service =
- ExtensionSystem::Get(profile_)->extension_service();
+ ExtensionSystem::Get(context_)->extension_service();
std::string extension_id;
if (!extensions::UnpackedInstaller::Create(extension_service)
->LoadFromCommandLine(base::FilePath(extension_path), &extension_id,
@@ -82,7 +82,7 @@ bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path,
bool AppLoadService::Load(const base::FilePath& extension_path) {
ExtensionService* extension_service =
- ExtensionSystem::Get(profile_)->extension_service();
+ ExtensionSystem::Get(context_)->extension_service();
std::string extension_id;
return extensions::UnpackedInstaller::Create(extension_service)
->LoadFromCommandLine(base::FilePath(extension_path), &extension_id,
@@ -90,8 +90,8 @@ bool AppLoadService::Load(const base::FilePath& extension_path) {
}
// static
-AppLoadService* AppLoadService::Get(Profile* profile) {
- return apps::AppLoadServiceFactory::GetForProfile(profile);
+AppLoadService* AppLoadService::Get(content::BrowserContext* context) {
+ return apps::AppLoadServiceFactory::GetForBrowserContext(context);
}
void AppLoadService::Observe(int type,
@@ -111,17 +111,15 @@ void AppLoadService::Observe(int type,
switch (it->second.action_type) {
case LAUNCH_FOR_RELOAD:
- LaunchPlatformApp(profile_, extension, extensions::SOURCE_RELOAD);
+ LaunchPlatformApp(context_, extension, extensions::SOURCE_RELOAD);
break;
case RESTART:
- RestartPlatformApp(profile_, extension);
+ RestartPlatformApp(context_, extension);
break;
case LAUNCH_FOR_LOAD_AND_LAUNCH:
- LaunchPlatformAppWithCommandLine(profile_,
- extension,
- it->second.command_line,
- it->second.current_dir,
- extensions::SOURCE_LOAD_AND_LAUNCH);
+ LaunchPlatformAppWithCommandLine(
+ context_, extension, it->second.command_line, it->second.current_dir,
+ extensions::SOURCE_LOAD_AND_LAUNCH);
break;
default:
NOTREACHED();
@@ -150,7 +148,7 @@ bool AppLoadService::WasUnloadedForReload(
const extensions::ExtensionId& extension_id,
const extensions::UnloadedExtensionInfo::Reason reason) {
if (reason == extensions::UnloadedExtensionInfo::REASON_DISABLE) {
- ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(context_);
return (prefs->GetDisableReasons(extension_id) &
Extension::DISABLE_RELOAD) != 0;
}
« no previous file with comments | « apps/app_load_service.h ('k') | apps/app_load_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698