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

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

Issue 11886079: Revert 177136 due to memory error on Mac ASAN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('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
===================================================================
--- chrome/browser/sync/sync_ui_util.cc (revision 177205)
+++ chrome/browser/sync/sync_ui_util.cc (working copy)
@@ -44,7 +44,10 @@
void GetStatusLabelsForAuthError(const AuthError& auth_error,
const ProfileSyncService& service,
string16* status_label,
- string16* link_label) {
+ string16* link_label,
+ 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);
@@ -67,6 +70,18 @@
status_label->assign(
l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_INFO_OUT_OF_DATE));
}
+ if (global_error_menu_label) {
+ global_error_menu_label->assign(l10n_util::GetStringUTF16(
+ IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM));
+ }
+ if (global_error_bubble_message) {
+ global_error_bubble_message->assign(l10n_util::GetStringFUTF16(
+ IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_MESSAGE, product_name));
+ }
+ if (global_error_bubble_accept_label) {
+ global_error_bubble_accept_label->assign(l10n_util::GetStringUTF16(
+ IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_ACCEPT));
+ }
}
break;
case AuthError::SERVICE_UNAVAILABLE:
@@ -76,6 +91,18 @@
}
if (link_label)
link_label->clear();
+ if (global_error_menu_label) {
+ global_error_menu_label->assign(l10n_util::GetStringUTF16(
+ IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM));
+ }
+ if (global_error_bubble_message) {
+ global_error_bubble_message->assign(l10n_util::GetStringFUTF16(
+ IDS_SYNC_UNAVAILABLE_ERROR_BUBBLE_VIEW_MESSAGE, product_name));
+ }
+ if (global_error_bubble_accept_label) {
+ global_error_bubble_accept_label->assign(l10n_util::GetStringUTF16(
+ IDS_SYNC_UNAVAILABLE_ERROR_BUBBLE_VIEW_ACCEPT));
+ }
break;
case AuthError::CONNECTION_FAILED:
// Note that there is little the user can do if the server is not
@@ -92,6 +119,18 @@
status_label->assign(l10n_util::GetStringUTF16(
IDS_SYNC_ERROR_SIGNING_IN));
}
+ if (global_error_menu_label) {
+ global_error_menu_label->assign(l10n_util::GetStringUTF16(
+ IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM));
+ }
+ if (global_error_bubble_message) {
+ global_error_bubble_message->assign(l10n_util::GetStringFUTF16(
+ IDS_SYNC_OTHER_SIGN_IN_ERROR_BUBBLE_VIEW_MESSAGE, product_name));
+ }
+ if (global_error_bubble_accept_label) {
+ global_error_bubble_accept_label->assign(l10n_util::GetStringUTF16(
+ IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_ACCEPT));
+ }
break;
}
}
@@ -197,8 +236,8 @@
// No auth in progress check for an auth error.
if (auth_error.state() != AuthError::NONE) {
if (status_label && link_label) {
- GetStatusLabelsForAuthError(
- auth_error, *service, status_label, link_label);
+ GetStatusLabelsForAuthError(auth_error, *service,
+ status_label, link_label, NULL, NULL, NULL);
}
return SYNC_ERROR;
}
@@ -254,7 +293,8 @@
auth_error.state() != AuthError::TWO_FACTOR) {
if (status_label) {
status_label->clear();
- GetStatusLabelsForAuthError(auth_error, *service, status_label, NULL);
+ GetStatusLabelsForAuthError(auth_error, *service, status_label, NULL,
+ NULL, NULL, NULL);
}
result_type = SYNC_ERROR;
}
@@ -348,11 +388,22 @@
*bubble_message = string16();
*bubble_accept_label = string16();
- // Only display an error if we've completed sync setup.
if (!service->HasSyncSetupCompleted())
return;
- // Display a passphrase error if we have one.
+ MessageType status = GetStatus(service, signin);
+ if (status == SYNC_ERROR) {
+ const AuthError& auth_error = service->GetAuthError();
+ if (auth_error.state() != AuthError::NONE) {
+ GetStatusLabelsForAuthError(auth_error, *service, NULL, NULL,
+ menu_label, bubble_message, bubble_accept_label);
+ // If we have an actionable auth error, display it.
+ if (!menu_label->empty())
+ return;
+ }
+ }
+
+ // No actionable auth error - display the passphrase error.
if (service->IsPassphraseRequired() &&
service->IsPassphraseRequiredForDecryption()) {
// This is not the first machine so ask user to enter passphrase.
@@ -372,6 +423,18 @@
return sync_ui_util::GetStatusInfo(service, signin, WITH_HTML, NULL, NULL);
}
+string16 GetSyncMenuLabel(
+ ProfileSyncService* service, const SigninManager& signin) {
+ MessageType type = GetStatus(service, signin);
+
+ if (type == sync_ui_util::SYNCED)
+ return l10n_util::GetStringUTF16(IDS_SYNC_MENU_SYNCED_LABEL);
+ else if (type == sync_ui_util::SYNC_ERROR)
+ return l10n_util::GetStringUTF16(IDS_SYNC_MENU_SYNC_ERROR_LABEL);
+ else
+ return l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL);
+}
+
string16 ConstructTime(int64 time_in_int) {
base::Time time = base::Time::FromInternalValue(time_in_int);
@@ -381,4 +444,21 @@
return base::TimeFormatFriendlyDateAndTime(time);
}
+std::string MakeSyncAuthErrorText(
+ const GoogleServiceAuthError::State& state) {
+ switch (state) {
+ case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
+ case GoogleServiceAuthError::ACCOUNT_DELETED:
+ case GoogleServiceAuthError::ACCOUNT_DISABLED:
+ case GoogleServiceAuthError::SERVICE_UNAVAILABLE:
+ return "INVALID_GAIA_CREDENTIALS";
+ case GoogleServiceAuthError::USER_NOT_SIGNED_UP:
+ return "USER_NOT_SIGNED_UP";
+ case GoogleServiceAuthError::CONNECTION_FAILED:
+ return "CONNECTION_FAILED";
+ default:
+ return std::string();
+ }
+}
+
} // namespace sync_ui_util
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698