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

Unified Diff: chrome/browser/sync/sync_ui_util.cc

Issue 8665011: sync: remove GetAuthenticatedUsername from ProfileSyncService/SyncBackendHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: init Created 9 years, 1 month 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/sync/sync_setup_wizard_unittest.cc ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sync_ui_util.cc
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc
index 2bfd6c62140ce6cc203827622f8a780cc182cd44..0898f29ecc6ec903d138611cd54bfc201af99906 100644
--- a/chrome/browser/sync/sync_ui_util.cc
+++ b/chrome/browser/sync/sync_ui_util.cc
@@ -8,6 +8,7 @@
#include "base/i18n/time_formatting.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -20,6 +21,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
@@ -43,6 +45,8 @@ void GetStatusLabelsForAuthError(const AuthError& auth_error,
string16* global_error_menu_label,
string16* global_error_bubble_message,
string16* global_error_bubble_accept_label) {
+ string16 username = UTF8ToUTF16(service.profile()->GetPrefs()->GetString(
+ prefs::kGoogleServicesUsername));
string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
if (link_label)
link_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_RELOGIN_LINK_LABEL));
@@ -53,7 +57,7 @@ void GetStatusLabelsForAuthError(const AuthError& auth_error,
case AuthError::ACCOUNT_DISABLED:
// If the user name is empty then the first login failed, otherwise the
// credentials are out-of-date.
- if (service.GetAuthenticatedUsername().empty()) {
+ if (username.empty()) {
if (status_label) {
status_label->assign(
l10n_util::GetStringUTF16(IDS_SYNC_INVALID_USER_CREDENTIALS));
@@ -78,7 +82,6 @@ void GetStatusLabelsForAuthError(const AuthError& auth_error,
}
break;
case AuthError::SERVICE_UNAVAILABLE:
- DCHECK(service.GetAuthenticatedUsername().empty());
tim (not reviewing) 2011/11/23 20:13:42 AFAICT, this was a bogus dcheck (except in the ini
if (status_label) {
status_label->assign(
l10n_util::GetStringUTF16(IDS_SYNC_SERVICE_UNAVAILABLE));
@@ -134,13 +137,14 @@ void GetStatusLabelsForAuthError(const AuthError& auth_error,
// empty string is returned.
string16 GetSyncedStateStatusLabel(ProfileSyncService* service) {
string16 label;
- string16 user_name(service->GetAuthenticatedUsername());
- if (user_name.empty())
- return label;
+ if (!service->sync_initialized())
+ return string16();
+ string16 username = UTF8ToUTF16(service->profile()->GetPrefs()->GetString(
+ prefs::kGoogleServicesUsername));
return l10n_util::GetStringFUTF16(
IDS_SYNC_ACCOUNT_SYNCING_TO_USER,
- user_name,
+ username,
ASCIIToUTF16(chrome::kSyncGoogleDashboardURL));
}
« no previous file with comments | « chrome/browser/sync/sync_setup_wizard_unittest.cc ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698