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

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

Issue 297853006: Make sure auth error reporting handles guest mode correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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
« no previous file with comments | « chrome/browser/profiles/profiles_state.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/profiles/new_avatar_button.cc
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc
index ec28c46d12f6bfd6ecc1366fa9ca58afb44a29c7..d50c260a369f52bfb91abed8ded014ac57a7cabc 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.cc
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc
@@ -104,12 +104,14 @@ NewAvatarButton::NewAvatarButton(
g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this);
// Subscribe to authentication error changes so that the avatar button
- // can update itself.
+ // can update itself. Note that guest mode profiles won't have a token
+ // service.
SigninErrorController* error =
- ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile())->
- signin_error_controller();
- error->AddObserver(this);
- OnErrorChanged();
+ profiles::GetSigninErrorController(browser_->profile());
+ if (error) {
+ error->AddObserver(this);
+ OnErrorChanged();
+ }
SchedulePaint();
}
@@ -118,9 +120,9 @@ NewAvatarButton::~NewAvatarButton() {
g_browser_process->profile_manager()->
GetProfileInfoCache().RemoveObserver(this);
SigninErrorController* error =
- ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile())->
- signin_error_controller();
- error->RemoveObserver(this);
+ profiles::GetSigninErrorController(browser_->profile());
+ if (error)
+ error->RemoveObserver(this);
}
void NewAvatarButton::OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode) {
@@ -159,10 +161,9 @@ void NewAvatarButton::OnErrorChanged() {
gfx::ImageSkia icon;
// If there is an error, show an warning icon.
- SigninErrorController* error =
- ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile())->
- signin_error_controller();
- if (error->HasError()) {
+ const SigninErrorController* error =
+ profiles::GetSigninErrorController(browser_->profile());
+ if (error && error->HasError()) {
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
icon = *rb->GetImageNamed(IDR_WARNING).ToImageSkia();
}
« no previous file with comments | « chrome/browser/profiles/profiles_state.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698