| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/sync_global_error.h" | 5 #include "chrome/browser/sync/sync_global_error.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/api/sync/profile_sync_service_observer.h" | 9 #include "chrome/browser/api/sync/profile_sync_service_observer.h" |
| 10 #include "chrome/browser/signin/about_signin_internals.h" |
| 11 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 9 #include "chrome/browser/sync/profile_sync_service.h" | 12 #include "chrome/browser/sync/profile_sync_service.h" |
| 10 #include "chrome/browser/sync/sync_ui_util.h" | 13 #include "chrome/browser/sync/sync_ui_util.h" |
| 11 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_commands.h" | 15 #include "chrome/browser/ui/browser_commands.h" |
| 13 #include "chrome/browser/ui/chrome_pages.h" | 16 #include "chrome/browser/ui/chrome_pages.h" |
| 14 #include "chrome/browser/ui/global_error/global_error_service.h" | 17 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 18 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 16 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 19 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 20 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 18 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 22 #include "google_apis/gaia/gaia_constants.h" |
| 19 #include "google_apis/gaia/google_service_auth_error.h" | 23 #include "google_apis/gaia/google_service_auth_error.h" |
| 20 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 21 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 23 | 27 |
| 24 typedef GoogleServiceAuthError AuthError; | 28 typedef GoogleServiceAuthError AuthError; |
| 25 | 29 |
| 26 SyncGlobalError::SyncGlobalError(ProfileSyncService* service, | 30 SyncGlobalError::SyncGlobalError(ProfileSyncService* service, |
| 27 SigninManager* signin) | 31 SigninManager* signin) |
| 28 : service_(service), | 32 : service_(service), |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 bubble_accept_label != bubble_accept_label_) { | 129 bubble_accept_label != bubble_accept_label_) { |
| 126 menu_label_ = menu_label; | 130 menu_label_ = menu_label; |
| 127 bubble_message_ = bubble_message; | 131 bubble_message_ = bubble_message; |
| 128 bubble_accept_label_ = bubble_accept_label; | 132 bubble_accept_label_ = bubble_accept_label; |
| 129 | 133 |
| 130 // Profile can be NULL during tests. | 134 // Profile can be NULL during tests. |
| 131 Profile* profile = service_->profile(); | 135 Profile* profile = service_->profile(); |
| 132 if (profile) { | 136 if (profile) { |
| 133 GlobalErrorServiceFactory::GetForProfile( | 137 GlobalErrorServiceFactory::GetForProfile( |
| 134 profile)->NotifyErrorsChanged(this); | 138 profile)->NotifyErrorsChanged(this); |
| 139 |
| 140 // Also push these errors to the about:signin-internals page. |
| 141 string16 consolidated_error_msg = menu_label_; |
| 142 consolidated_error_msg.append(bubble_message_.c_str()); |
| 143 NotifyTokenFailureOccurred(consolidated_error_msg); |
| 135 } | 144 } |
| 136 } | 145 } |
| 137 } | 146 } |
| 138 | 147 |
| 139 bool SyncGlobalError::HasCustomizedSyncMenuItem() { | 148 bool SyncGlobalError::HasCustomizedSyncMenuItem() { |
| 140 return !menu_label_.empty(); | 149 return !menu_label_.empty(); |
| 141 } | 150 } |
| 151 |
| 152 // TODO(vishwath): Ensure that it's not incorrect to be overwriting |
| 153 // regular token fetch status for the syncservice token. |
| 154 void SyncGlobalError::NotifyTokenFailureOccurred(const string16& error_msg) { |
| 155 DCHECK(service_->profile()); |
| 156 AboutSigninInternalsFactory::GetForProfile(service_->profile())-> |
| 157 NotifyTokenReceivedFailure(GaiaConstants::kSyncService, |
| 158 UTF16ToUTF8(error_msg)); |
| 159 } |
| OLD | NEW |