Commit 8695134d authored by blundell@chromium.org's avatar blundell@chromium.org

Rename SigninManagerDelegate to SigninClient

This renaming puts the Signin embedder interface in line with the agreed-upon
convention wherein a component Foo's embedder interface should be named
FooClient. ChromeSigninManagerDelegate is similarly renamed to
ChromeSigninClient, and variable names are updated.

BUG=334168
TBR=joi

Review URL: https://codereview.chromium.org/192253002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255903 0039d316-1c4b-4281-b951-d872f2087c98
parent e7179444
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/signin/chrome_signin_manager_delegate.h" #include "chrome/browser/signin/chrome_signin_client.h"
#include "chrome/browser/content_settings/cookie_settings.h" #include "chrome/browser/content_settings/cookie_settings.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -13,29 +13,25 @@ const char kGoogleAccountsUrl[] = "https://accounts.google.com"; ...@@ -13,29 +13,25 @@ const char kGoogleAccountsUrl[] = "https://accounts.google.com";
} // namespace } // namespace
ChromeSigninManagerDelegate::ChromeSigninManagerDelegate(Profile* profile) ChromeSigninClient::ChromeSigninClient(Profile* profile) : profile_(profile) {}
: profile_(profile) {
}
ChromeSigninManagerDelegate::~ChromeSigninManagerDelegate() { ChromeSigninClient::~ChromeSigninClient() {}
}
// static // static
bool ChromeSigninManagerDelegate::ProfileAllowsSigninCookies(Profile* profile) { bool ChromeSigninClient::ProfileAllowsSigninCookies(Profile* profile) {
CookieSettings* cookie_settings = CookieSettings* cookie_settings =
CookieSettings::Factory::GetForProfile(profile).get(); CookieSettings::Factory::GetForProfile(profile).get();
return SettingsAllowSigninCookies(cookie_settings); return SettingsAllowSigninCookies(cookie_settings);
} }
// static // static
bool ChromeSigninManagerDelegate::SettingsAllowSigninCookies( bool ChromeSigninClient::SettingsAllowSigninCookies(
CookieSettings* cookie_settings) { CookieSettings* cookie_settings) {
return cookie_settings && return cookie_settings &&
cookie_settings->IsSettingCookieAllowed(GURL(kGoogleAccountsUrl), cookie_settings->IsSettingCookieAllowed(GURL(kGoogleAccountsUrl),
GURL(kGoogleAccountsUrl)); GURL(kGoogleAccountsUrl));
} }
bool ChromeSigninClient::AreSigninCookiesAllowed() {
bool ChromeSigninManagerDelegate::AreSigninCookiesAllowed() {
return ProfileAllowsSigninCookies(profile_); return ProfileAllowsSigninCookies(profile_);
} }
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_MANAGER_DELEGATE_H_ #ifndef CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_
#define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_MANAGER_DELEGATE_H_ #define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "components/signin/core/signin_manager_delegate.h" #include "components/signin/core/signin_client.h"
class CookieSettings; class CookieSettings;
class Profile; class Profile;
class ChromeSigninManagerDelegate : public SigninManagerDelegate { class ChromeSigninClient : public SigninClient {
public: public:
explicit ChromeSigninManagerDelegate(Profile* profile); explicit ChromeSigninClient(Profile* profile);
virtual ~ChromeSigninManagerDelegate(); virtual ~ChromeSigninClient();
// Utility methods. // Utility methods.
static bool ProfileAllowsSigninCookies(Profile* profile); static bool ProfileAllowsSigninCookies(Profile* profile);
static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings); static bool SettingsAllowSigninCookies(CookieSettings* cookie_settings);
// SigninManagerDelegate implementation. // SigninClient implementation.
virtual bool AreSigninCookiesAllowed() OVERRIDE; virtual bool AreSigninCookiesAllowed() OVERRIDE;
private: private:
...@@ -29,7 +29,7 @@ class ChromeSigninManagerDelegate : public SigninManagerDelegate { ...@@ -29,7 +29,7 @@ class ChromeSigninManagerDelegate : public SigninManagerDelegate {
// outlived by Profile. // outlived by Profile.
Profile* profile_; Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(ChromeSigninManagerDelegate); DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient);
}; };
#endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_MANAGER_DELEGATE_H_ #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_CLIENT_H_
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/chrome_signin_manager_delegate.h" #include "chrome/browser/signin/chrome_signin_client.h"
#include "chrome/browser/signin/signin_global_error.h" #include "chrome/browser/signin/signin_global_error.h"
#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/global_error/global_error_service.h" #include "chrome/browser/ui/global_error/global_error_service.h"
...@@ -41,8 +41,7 @@ BrowserContextKeyedService* FakeSigninManagerBase::Build( ...@@ -41,8 +41,7 @@ BrowserContextKeyedService* FakeSigninManagerBase::Build(
#if !defined (OS_CHROMEOS) #if !defined (OS_CHROMEOS)
FakeSigninManager::FakeSigninManager(Profile* profile) FakeSigninManager::FakeSigninManager(Profile* profile)
: SigninManager(scoped_ptr<SigninManagerDelegate>( : SigninManager(scoped_ptr<SigninClient>(new ChromeSigninClient(profile))) {
new ChromeSigninManagerDelegate(profile))) {
} }
FakeSigninManager::~FakeSigninManager() { FakeSigninManager::~FakeSigninManager() {
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
#include "chrome/browser/ui/global_error/global_error_service_factory.h" #include "chrome/browser/ui/global_error/global_error_service_factory.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/profile_management_switches.h" #include "chrome/common/profile_management_switches.h"
#include "components/signin/core/signin_client.h"
#include "components/signin/core/signin_manager_cookie_helper.h" #include "components/signin/core/signin_manager_cookie_helper.h"
#include "components/signin/core/signin_manager_delegate.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
...@@ -82,14 +82,13 @@ bool SigninManager::IsWebBasedSigninFlowURL(const GURL& url) { ...@@ -82,14 +82,13 @@ bool SigninManager::IsWebBasedSigninFlowURL(const GURL& url) {
.find(kChromiumSyncService) != std::string::npos; .find(kChromiumSyncService) != std::string::npos;
} }
SigninManager::SigninManager(scoped_ptr<SigninManagerDelegate> delegate) SigninManager::SigninManager(scoped_ptr<SigninClient> client)
: prohibit_signout_(false), : prohibit_signout_(false),
had_two_factor_error_(false), had_two_factor_error_(false),
type_(SIGNIN_TYPE_NONE), type_(SIGNIN_TYPE_NONE),
weak_pointer_factory_(this), weak_pointer_factory_(this),
signin_host_id_(ChildProcessHost::kInvalidUniqueID), signin_host_id_(ChildProcessHost::kInvalidUniqueID),
delegate_(delegate.Pass()) { client_(client.Pass()) {}
}
void SigninManager::SetSigninProcess(int process_id) { void SigninManager::SetSigninProcess(int process_id) {
if (process_id == signin_host_id_) if (process_id == signin_host_id_)
......
...@@ -47,7 +47,7 @@ class ProfileIOData; ...@@ -47,7 +47,7 @@ class ProfileIOData;
class PrefService; class PrefService;
class SigninAccountIdHelper; class SigninAccountIdHelper;
class SigninGlobalError; class SigninGlobalError;
class SigninManagerDelegate; class SigninClient;
class SigninManager : public SigninManagerBase, class SigninManager : public SigninManagerBase,
public GaiaAuthConsumer, public GaiaAuthConsumer,
...@@ -70,7 +70,7 @@ class SigninManager : public SigninManagerBase, ...@@ -70,7 +70,7 @@ class SigninManager : public SigninManagerBase,
// OneClickSigninHelper. // OneClickSigninHelper.
static const char* kChromeSigninEffectiveSite; static const char* kChromeSigninEffectiveSite;
explicit SigninManager(scoped_ptr<SigninManagerDelegate> delegate); explicit SigninManager(scoped_ptr<SigninClient> client);
virtual ~SigninManager(); virtual ~SigninManager();
// Returns true if the username is allowed based on the policy string. // Returns true if the username is allowed based on the policy string.
...@@ -286,7 +286,7 @@ class SigninManager : public SigninManagerBase, ...@@ -286,7 +286,7 @@ class SigninManager : public SigninManagerBase,
// but before signin is complete. // but before signin is complete.
OAuthTokenFetchedCallback oauth_token_fetched_callback_; OAuthTokenFetchedCallback oauth_token_fetched_callback_;
scoped_ptr<SigninManagerDelegate> delegate_; scoped_ptr<SigninClient> client_;
// Helper object to listen for changes to signin preferences stored in non- // Helper object to listen for changes to signin preferences stored in non-
// profile-specific local prefs (like kGoogleServicesUsernamePattern). // profile-specific local prefs (like kGoogleServicesUsernamePattern).
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_registry_simple.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/signin/chrome_signin_manager_delegate.h" #include "chrome/browser/signin/chrome_signin_client.h"
#include "chrome/browser/signin/local_auth.h" #include "chrome/browser/signin/local_auth.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h" #include "chrome/browser/signin/signin_manager.h"
...@@ -127,8 +127,7 @@ BrowserContextKeyedService* SigninManagerFactory::BuildServiceInstanceFor( ...@@ -127,8 +127,7 @@ BrowserContextKeyedService* SigninManagerFactory::BuildServiceInstanceFor(
service = new SigninManagerBase(); service = new SigninManagerBase();
#else #else
service = new SigninManager( service = new SigninManager(
scoped_ptr<SigninManagerDelegate>( scoped_ptr<SigninClient>(new ChromeSigninClient(profile)));
new ChromeSigninManagerDelegate(profile)));
#endif #endif
service->Initialize(profile, g_browser_process->local_state()); service->Initialize(profile, g_browser_process->local_state());
FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(service)); FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(service));
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/signin/chrome_signin_manager_delegate.h" #include "chrome/browser/signin/chrome_signin_client.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h" #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h" #include "chrome/browser/signin/profile_oauth2_token_service.h"
...@@ -55,8 +55,7 @@ BrowserContextKeyedService* SigninManagerBuild( ...@@ -55,8 +55,7 @@ BrowserContextKeyedService* SigninManagerBuild(
SigninManager* service = NULL; SigninManager* service = NULL;
Profile* profile = static_cast<Profile*>(context); Profile* profile = static_cast<Profile*>(context);
service = new SigninManager( service = new SigninManager(
scoped_ptr<SigninManagerDelegate>( scoped_ptr<SigninClient>(new ChromeSigninClient(profile)));
new ChromeSigninManagerDelegate(profile)));
service->Initialize(profile, NULL); service->Initialize(profile, NULL);
return service; return service;
} }
...@@ -147,8 +146,7 @@ class SigninManagerTest : public testing::Test { ...@@ -147,8 +146,7 @@ class SigninManagerTest : public testing::Test {
void CreateNakedSigninManager() { void CreateNakedSigninManager() {
DCHECK(!manager_); DCHECK(!manager_);
naked_manager_.reset(new SigninManager( naked_manager_.reset(new SigninManager(
scoped_ptr<SigninManagerDelegate>( scoped_ptr<SigninClient>(new ChromeSigninClient(profile()))));
new ChromeSigninManagerDelegate(profile()))));
manager_ = naked_manager_.get(); manager_ = naked_manager_.get();
manager_->AddObserver(&test_observer_); manager_->AddObserver(&test_observer_);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search/search.h" #include "chrome/browser/search/search.h"
#include "chrome/browser/signin/chrome_signin_manager_delegate.h" #include "chrome/browser/signin/chrome_signin_client.h"
#include "chrome/browser/signin/signin_global_error.h" #include "chrome/browser/signin/signin_global_error.h"
#include "chrome/browser/signin/signin_manager.h" #include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_manager_factory.h"
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "components/autofill/core/common/password_form.h" #include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/password_manager.h"
#include "components/signin/core/signin_manager_delegate.h" #include "components/signin/core/signin_client.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "content/public/browser/page_navigator.h" #include "content/public/browser/page_navigator.h"
...@@ -697,7 +697,7 @@ bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents, ...@@ -697,7 +697,7 @@ bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents,
!profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled))
return false; return false;
if (!ChromeSigninManagerDelegate::ProfileAllowsSigninCookies(profile)) if (!ChromeSigninClient::ProfileAllowsSigninCookies(profile))
return false; return false;
if (!email.empty()) { if (!email.empty()) {
...@@ -801,7 +801,7 @@ OneClickSigninHelper::Offer OneClickSigninHelper::CanOfferOnIOThreadImpl( ...@@ -801,7 +801,7 @@ OneClickSigninHelper::Offer OneClickSigninHelper::CanOfferOnIOThreadImpl(
if (!io_data->google_services_username()->GetValue().empty()) if (!io_data->google_services_username()->GetValue().empty())
return DONT_OFFER; return DONT_OFFER;
if (!ChromeSigninManagerDelegate::SettingsAllowSigninCookies( if (!ChromeSigninClient::SettingsAllowSigninCookies(
io_data->GetCookieSettings())) io_data->GetCookieSettings()))
return DONT_OFFER; return DONT_OFFER;
......
...@@ -2102,8 +2102,8 @@ ...@@ -2102,8 +2102,8 @@
'browser/signin/account_reconcilor.h', 'browser/signin/account_reconcilor.h',
'browser/signin/account_reconcilor_factory.cc', 'browser/signin/account_reconcilor_factory.cc',
'browser/signin/account_reconcilor_factory.h', 'browser/signin/account_reconcilor_factory.h',
'browser/signin/chrome_signin_manager_delegate.cc', 'browser/signin/chrome_signin_client.cc',
'browser/signin/chrome_signin_manager_delegate.h', 'browser/signin/chrome_signin_client.h',
'browser/signin/local_auth.cc', 'browser/signin/local_auth.cc',
'browser/signin/local_auth.h', 'browser/signin/local_auth.h',
'browser/signin/mutable_profile_oauth2_token_service.cc', 'browser/signin/mutable_profile_oauth2_token_service.cc',
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
'..', '..',
], ],
'sources': [ 'sources': [
'signin/core/signin_client.h',
'signin/core/signin_manager_cookie_helper.cc', 'signin/core/signin_manager_cookie_helper.cc',
'signin/core/signin_manager_cookie_helper.h', 'signin/core/signin_manager_cookie_helper.h',
'signin/core/signin_manager_delegate.h',
'signin/core/webdata/token_service_table.cc', 'signin/core/webdata/token_service_table.cc',
'signin/core/webdata/token_service_table.h', 'signin/core/webdata/token_service_table.h',
'signin/core/webdata/token_web_data.cc', 'signin/core/webdata/token_web_data.cc',
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_CORE_SIGNIN_MANAGER_DELEGATE_H_ #ifndef COMPONENTS_SIGNIN_CORE_SIGNIN_CLIENT_H_
#define COMPONENTS_SIGNIN_CORE_SIGNIN_MANAGER_DELEGATE_H_ #define COMPONENTS_SIGNIN_CORE_SIGNIN_CLIENT_H_
// A delegate interface that needs to be supplied to the Signin component by // An interface that needs to be supplied to the Signin component by its
// its embedder. // embedder.
class SigninManagerDelegate { class SigninClient {
public: public:
virtual ~SigninManagerDelegate() {} virtual ~SigninClient() {}
// Returns true if the cookie policy for the execution context of // Returns true if the cookie policy for the execution context of
// the SigninManager allows cookies for the Google signin domain. // the SigninManager allows cookies for the Google signin domain.
virtual bool AreSigninCookiesAllowed() = 0; virtual bool AreSigninCookiesAllowed() = 0;
}; };
#endif // COMPONENTS_SIGNIN_CORE_SIGNIN_MANAGER_DELEGATE_H_ #endif // COMPONENTS_SIGNIN_CORE_SIGNIN_CLIENT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment