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

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 297853006: Make sure auth error reporting handles guest mode correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/ui/views/profiles/profile_chooser_view.cc
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
index 67f33223a1c6ec82a2327fa09ff2522d6d315730..01f317200324a357f284fc6a66789232b455a1b5 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -97,17 +97,20 @@ gfx::ImageSkia CreateSquarePlaceholderImage(int size) {
return gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
}
+// Note that guest mode profiles won't have a token service.
+const SigninErrorController* GetSigninErrorController(Profile* profile) {
+ const ProfileOAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
+ return token_service ? token_service->signin_error_controller() : NULL;
+}
+
bool HasAuthError(Profile* profile) {
- SigninErrorController* error =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->
- signin_error_controller();
+ const SigninErrorController* error = GetSigninErrorController(profile);
return error && error->HasError();
}
std::string GetAuthErrorAccountId(Profile* profile) {
- SigninErrorController* error =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->
- signin_error_controller();
+ const SigninErrorController* error = GetSigninErrorController(profile);
if (!error)
return std::string();
@@ -115,9 +118,7 @@ std::string GetAuthErrorAccountId(Profile* profile) {
}
std::string GetAuthErrorUsername(Profile* profile) {
- SigninErrorController* error =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile)->
- signin_error_controller();
+ const SigninErrorController* error = GetSigninErrorController(profile);
if (!error)
return std::string();

Powered by Google App Engine
This is Rietveld 408576698