| 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 "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 string16 SigninGlobalError::GetBubbleViewTitle() { | 142 string16 SigninGlobalError::GetBubbleViewTitle() { |
| 143 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE); | 143 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE); |
| 144 } | 144 } |
| 145 | 145 |
| 146 std::vector<string16> SigninGlobalError::GetBubbleViewMessages() { | 146 std::vector<string16> SigninGlobalError::GetBubbleViewMessages() { |
| 147 std::vector<string16> messages; | 147 std::vector<string16> messages; |
| 148 | 148 |
| 149 // If the user isn't signed in, no need to display an error bubble. | 149 // If the user isn't signed in, no need to display an error bubble. |
| 150 SigninManagerBase* signin_manager = | 150 SigninManagerBase* signin_manager = |
| 151 SigninManagerFactory::GetForProfileIfExists(profile_); | 151 SigninManagerFactory::GetForBrowserContextIfExists(profile_); |
| 152 if (signin_manager) { | 152 if (signin_manager) { |
| 153 std::string username = signin_manager->GetAuthenticatedUsername(); | 153 std::string username = signin_manager->GetAuthenticatedUsername(); |
| 154 if (username.empty()) | 154 if (username.empty()) |
| 155 return messages; | 155 return messages; |
| 156 } | 156 } |
| 157 | 157 |
| 158 switch (auth_error_.state()) { | 158 switch (auth_error_.state()) { |
| 159 // In the case of no error, or a simple network error, don't bother | 159 // In the case of no error, or a simple network error, don't bother |
| 160 // displaying a popup bubble. | 160 // displaying a popup bubble. |
| 161 case GoogleServiceAuthError::CONNECTION_FAILED: | 161 case GoogleServiceAuthError::CONNECTION_FAILED: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { | 214 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { |
| 215 NOTREACHED(); | 215 NOTREACHED(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 // static | 218 // static |
| 219 SigninGlobalError* SigninGlobalError::GetForProfile(Profile* profile) { | 219 SigninGlobalError* SigninGlobalError::GetForProfile(Profile* profile) { |
| 220 return ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> | 220 return ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
| 221 signin_global_error(); | 221 signin_global_error(); |
| 222 } | 222 } |
| OLD | NEW |