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

Side by Side Diff: chrome/browser/signin/signin_global_error.cc

Issue 479353003: Add IsAuthenticated() method to SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/signin/signin_global_error.h" 5 #include "chrome/browser/signin/signin_global_error.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/signin_header_helper.h" 10 #include "chrome/browser/signin/signin_header_helper.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 base::string16 SigninGlobalError::GetBubbleViewTitle() { 117 base::string16 SigninGlobalError::GetBubbleViewTitle() {
118 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE); 118 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE);
119 } 119 }
120 120
121 std::vector<base::string16> SigninGlobalError::GetBubbleViewMessages() { 121 std::vector<base::string16> SigninGlobalError::GetBubbleViewMessages() {
122 std::vector<base::string16> messages; 122 std::vector<base::string16> messages;
123 123
124 // If the user isn't signed in, no need to display an error bubble. 124 // If the user isn't signed in, no need to display an error bubble.
125 SigninManagerBase* signin_manager = 125 SigninManagerBase* signin_manager =
126 SigninManagerFactory::GetForProfileIfExists(profile_); 126 SigninManagerFactory::GetForProfileIfExists(profile_);
127 if (signin_manager) { 127 if (signin_manager && !signin_manager->IsAuthenticated())
128 std::string username = signin_manager->GetAuthenticatedUsername();
129 if (username.empty())
130 return messages; 128 return messages;
131 }
132 129
133 if (!error_controller_->HasError()) 130 if (!error_controller_->HasError())
134 return messages; 131 return messages;
135 132
136 switch (error_controller_->auth_error().state()) { 133 switch (error_controller_->auth_error().state()) {
137 // TODO(rogerta): use account id in error messages. 134 // TODO(rogerta): use account id in error messages.
138 135
139 // User credentials are invalid (bad acct, etc). 136 // User credentials are invalid (bad acct, etc).
140 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: 137 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
141 case GoogleServiceAuthError::SERVICE_ERROR: 138 case GoogleServiceAuthError::SERVICE_ERROR:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 ExecuteMenuItem(browser); 179 ExecuteMenuItem(browser);
183 } 180 }
184 181
185 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { 182 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) {
186 NOTREACHED(); 183 NOTREACHED();
187 } 184 }
188 185
189 void SigninGlobalError::OnErrorChanged() { 186 void SigninGlobalError::OnErrorChanged() {
190 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); 187 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this);
191 } 188 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/gaia_info_update_service.cc ('k') | chrome/browser/signin/signin_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698