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

Unified Diff: chrome/browser/extensions/signin/gaia_auth_extension_loader.cc

Issue 174513003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
Index: chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
diff --git a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
index 627d2b3403a27e4bf9734c4ddd75363ec5d0e312..6b88f54d6b0a17aca573019e0e92620f257bce32 100644
--- a/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
+++ b/chrome/browser/extensions/signin/gaia_auth_extension_loader.cc
@@ -11,9 +11,9 @@
#include "base/logging.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_system.h"
#include "grit/browser_resources.h"
@@ -25,21 +25,22 @@
#include "chromeos/chromeos_switches.h"
#endif
+using content::BrowserContext;
using content::BrowserThread;
namespace {
-extensions::ComponentLoader* GetComponentLoader(Profile* profile) {
+extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) {
extensions::ExtensionSystem* extension_system =
- extensions::ExtensionSystem::Get(profile);
+ extensions::ExtensionSystem::Get(context);
ExtensionService* extension_service = extension_system->extension_service();
return extension_service->component_loader();
}
-void LoadGaiaAuthExtension(Profile* profile) {
+void LoadGaiaAuthExtension(BrowserContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- extensions::ComponentLoader* component_loader = GetComponentLoader(profile);
+ extensions::ComponentLoader* component_loader = GetComponentLoader(context);
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
base::FilePath auth_extension_path =
@@ -75,19 +76,19 @@ void LoadGaiaAuthExtension(Profile* profile) {
base::FilePath(FILE_PATH_LITERAL("gaia_auth")));
}
-void UnloadGaiaAuthExtension(Profile* profile) {
+void UnloadGaiaAuthExtension(BrowserContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
const char kGaiaAuthId[] = "mfffpogegjflfpflabcdkioaeobkgjik";
- GetComponentLoader(profile)->Remove(kGaiaAuthId);
+ GetComponentLoader(context)->Remove(kGaiaAuthId);
}
} // namespace
namespace extensions {
-GaiaAuthExtensionLoader::GaiaAuthExtensionLoader(Profile* profile)
- : profile_(profile), load_count_(0) {}
+GaiaAuthExtensionLoader::GaiaAuthExtensionLoader(BrowserContext* context)
+ : browser_context_(context), load_count_(0) {}
GaiaAuthExtensionLoader::~GaiaAuthExtensionLoader() {
DCHECK_EQ(0, load_count_);
@@ -95,27 +96,27 @@ GaiaAuthExtensionLoader::~GaiaAuthExtensionLoader() {
void GaiaAuthExtensionLoader::LoadIfNeeded() {
if (load_count_ == 0)
- LoadGaiaAuthExtension(profile_);
+ LoadGaiaAuthExtension(browser_context_);
++load_count_;
}
void GaiaAuthExtensionLoader::UnloadIfNeeded() {
--load_count_;
if (load_count_ == 0)
- UnloadGaiaAuthExtension(profile_);
+ UnloadGaiaAuthExtension(browser_context_);
}
void GaiaAuthExtensionLoader::Shutdown() {
if (load_count_ > 0) {
- UnloadGaiaAuthExtension(profile_);
+ UnloadGaiaAuthExtension(browser_context_);
load_count_ = 0;
}
}
// static
-GaiaAuthExtensionLoader* GaiaAuthExtensionLoader::Get(Profile* profile) {
+GaiaAuthExtensionLoader* GaiaAuthExtensionLoader::Get(BrowserContext* context) {
return ProfileKeyedAPIFactory<GaiaAuthExtensionLoader>::GetForProfile(
- profile);
+ context);
}
static base::LazyInstance<ProfileKeyedAPIFactory<GaiaAuthExtensionLoader> >

Powered by Google App Engine
This is Rietveld 408576698