OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |