diff options
author | Ben Murdoch <benm@google.com> | 2014-03-31 11:51:25 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2014-03-31 11:51:25 +0100 |
commit | effb81e5f8246d0db0270817048dc992db66e9fb (patch) | |
tree | cc45ced7dfde038c8f3d022ee1eeac207a68761e /chrome/browser/signin/profile_oauth2_token_service_factory.cc | |
parent | 4d26337013537c1acafbcb63b9b2b7e404c3adc9 (diff) | |
download | chromium_org-effb81e5f8246d0db0270817048dc992db66e9fb.tar.gz |
Merge from Chromium at DEPS revision 260458
This commit was generated by merge_to_master.py.
Change-Id: I140fa91b7f09c8efba4424e99ccb87b94a11d022
Diffstat (limited to 'chrome/browser/signin/profile_oauth2_token_service_factory.cc')
-rw-r--r-- | chrome/browser/signin/profile_oauth2_token_service_factory.cc | 60 |
1 files changed, 11 insertions, 49 deletions
diff --git a/chrome/browser/signin/profile_oauth2_token_service_factory.cc b/chrome/browser/signin/profile_oauth2_token_service_factory.cc index a7cb8bf5d0..14c76ac20e 100644 --- a/chrome/browser/signin/profile_oauth2_token_service_factory.cc +++ b/chrome/browser/signin/profile_oauth2_token_service_factory.cc @@ -9,50 +9,14 @@ #include "chrome/browser/ui/global_error/global_error_service_factory.h" #include "chrome/browser/webdata/web_data_service_factory.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "components/signin/core/profile_oauth2_token_service.h" +#include "components/signin/core/browser/profile_oauth2_token_service.h" #if defined(OS_ANDROID) #include "chrome/browser/signin/android_profile_oauth2_token_service.h" #else -#include "components/signin/core/mutable_profile_oauth2_token_service.h" +#include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" #endif -class ProfileOAuth2TokenServiceWrapperImpl - : public ProfileOAuth2TokenServiceWrapper { - public: - explicit ProfileOAuth2TokenServiceWrapperImpl(Profile* profile); - virtual ~ProfileOAuth2TokenServiceWrapperImpl(); - - // ProfileOAuth2TokenServiceWrapper: - virtual ProfileOAuth2TokenService* GetProfileOAuth2TokenService() OVERRIDE; - - // KeyedService: - virtual void Shutdown() OVERRIDE; - - private: - scoped_ptr<ProfileOAuth2TokenService> profile_oauth2_token_service_; -}; - -ProfileOAuth2TokenServiceWrapperImpl::ProfileOAuth2TokenServiceWrapperImpl( - Profile* profile) { - profile_oauth2_token_service_.reset(new ProfileOAuth2TokenServiceFactory:: - PlatformSpecificOAuth2TokenService()); - ChromeSigninClient* client = - ChromeSigninClientFactory::GetInstance()->GetForProfile(profile); - profile_oauth2_token_service_->Initialize(client); -} - -ProfileOAuth2TokenServiceWrapperImpl::~ProfileOAuth2TokenServiceWrapperImpl() {} - -void ProfileOAuth2TokenServiceWrapperImpl::Shutdown() { - profile_oauth2_token_service_->Shutdown(); -} - -ProfileOAuth2TokenService* -ProfileOAuth2TokenServiceWrapperImpl::GetProfileOAuth2TokenService() { - return profile_oauth2_token_service_.get(); -} - ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory() : BrowserContextKeyedServiceFactory( "ProfileOAuth2TokenService", @@ -65,24 +29,18 @@ ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory() ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() { } -// static ProfileOAuth2TokenService* ProfileOAuth2TokenServiceFactory::GetForProfile(Profile* profile) { - ProfileOAuth2TokenServiceWrapper* wrapper = - static_cast<ProfileOAuth2TokenServiceWrapper*>( - GetInstance()->GetServiceForBrowserContext(profile, true)); - if (!wrapper) - return NULL; - return wrapper->GetProfileOAuth2TokenService(); + return static_cast<ProfileOAuth2TokenService*>( + GetInstance()->GetServiceForBrowserContext(profile, true)); } // static ProfileOAuth2TokenServiceFactory::PlatformSpecificOAuth2TokenService* ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile( Profile* profile) { - ProfileOAuth2TokenService* service = - ProfileOAuth2TokenServiceFactory::GetForProfile(profile); - return static_cast<PlatformSpecificOAuth2TokenService*>(service); + return static_cast<PlatformSpecificOAuth2TokenService*>( + GetForProfile(profile)); } // static @@ -94,5 +52,9 @@ ProfileOAuth2TokenServiceFactory* KeyedService* ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { Profile* profile = static_cast<Profile*>(context); - return new ProfileOAuth2TokenServiceWrapperImpl(profile); + PlatformSpecificOAuth2TokenService* service = + new PlatformSpecificOAuth2TokenService(); + service->Initialize( + ChromeSigninClientFactory::GetInstance()->GetForProfile(profile)); + return service; } |