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_ui_util.h" | 5 #include "chrome/browser/sync/sync_ui_util.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void GetStatusLabelsForAuthError(const AuthError& auth_error, | 45 void GetStatusLabelsForAuthError(const AuthError& auth_error, |
46 const ProfileSyncService& service, | 46 const ProfileSyncService& service, |
47 string16* status_label, | 47 string16* status_label, |
48 string16* link_label, | 48 string16* link_label, |
49 string16* global_error_menu_label, | 49 string16* global_error_menu_label, |
50 string16* global_error_bubble_message, | 50 string16* global_error_bubble_message, |
51 string16* global_error_bubble_accept_label) { | 51 string16* global_error_bubble_accept_label) { |
52 string16 username = UTF8ToUTF16(service.profile()->GetPrefs()->GetString( | 52 string16 username = UTF8ToUTF16(service.profile()->GetPrefs()->GetString( |
53 prefs::kGoogleServicesUsername)); | 53 prefs::kGoogleServicesUsername)); |
54 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 54 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
55 // TODO(altimofeev): get rid of "if def" construction: use the same IDS | |
56 // names. The reason the suffix was used is that strings were submitted | |
57 // before the actual change. | |
58 #if defined(OS_CHROMEOS) | |
59 if (link_label) | |
60 link_label->assign( | |
61 l10n_util::GetStringUTF16(IDS_SYNC_RELOGIN_LINK_LABEL_CHROMEOS)); | |
62 #else | |
63 if (link_label) | 55 if (link_label) |
64 link_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_RELOGIN_LINK_LABEL)); | 56 link_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_RELOGIN_LINK_LABEL)); |
65 #endif | |
66 | 57 |
67 switch (auth_error.state()) { | 58 switch (auth_error.state()) { |
68 case AuthError::INVALID_GAIA_CREDENTIALS: | 59 case AuthError::INVALID_GAIA_CREDENTIALS: |
69 case AuthError::ACCOUNT_DELETED: | 60 case AuthError::ACCOUNT_DELETED: |
70 case AuthError::ACCOUNT_DISABLED: | 61 case AuthError::ACCOUNT_DISABLED: |
71 // If the user name is empty then the first login failed, otherwise the | 62 // If the user name is empty then the first login failed, otherwise the |
72 // credentials are out-of-date. | 63 // credentials are out-of-date. |
73 if (username.empty()) { | 64 if (username.empty()) { |
74 if (status_label) { | 65 if (status_label) { |
75 status_label->assign( | 66 status_label->assign( |
76 l10n_util::GetStringUTF16(IDS_SYNC_INVALID_USER_CREDENTIALS)); | 67 l10n_util::GetStringUTF16(IDS_SYNC_INVALID_USER_CREDENTIALS)); |
77 } | 68 } |
78 } else { | 69 } else { |
79 if (status_label) { | 70 if (status_label) { |
80 status_label->assign( | 71 status_label->assign( |
81 l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_INFO_OUT_OF_DATE)); | 72 l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_INFO_OUT_OF_DATE)); |
82 } | 73 } |
83 if (global_error_menu_label) { | 74 if (global_error_menu_label) { |
84 // TODO(altimofeev): get rid of "if def" construction: use the same | |
85 // IDS names. The reason the suffix was used is that strings were | |
86 // submitted before the actual change. | |
87 #if defined(OS_CHROMEOS) | |
88 global_error_menu_label->assign(l10n_util::GetStringUTF16( | |
89 IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM_CHROMEOS)); | |
90 #else | |
91 global_error_menu_label->assign(l10n_util::GetStringUTF16( | 75 global_error_menu_label->assign(l10n_util::GetStringUTF16( |
92 IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM)); | 76 IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM)); |
93 #endif | |
94 } | 77 } |
95 if (global_error_bubble_message) { | 78 if (global_error_bubble_message) { |
96 global_error_bubble_message->assign(l10n_util::GetStringFUTF16( | 79 global_error_bubble_message->assign(l10n_util::GetStringFUTF16( |
97 IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_MESSAGE, product_name)); | 80 IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_MESSAGE, product_name)); |
98 } | 81 } |
99 if (global_error_bubble_accept_label) { | 82 if (global_error_bubble_accept_label) { |
100 // TODO(altimofeev): get rid of "if def" construction: use the same | |
101 // IDS names. The reason the suffix was used is that strings were | |
102 // submitted before the actual change. | |
103 #if defined(OS_CHROMEOS) | |
104 global_error_bubble_accept_label->assign(l10n_util::GetStringUTF16( | |
105 IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_ACCEPT_CHROMEOS)); | |
106 #else | |
107 global_error_bubble_accept_label->assign(l10n_util::GetStringUTF16( | 83 global_error_bubble_accept_label->assign(l10n_util::GetStringUTF16( |
108 IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_ACCEPT)); | 84 IDS_SYNC_SIGN_IN_ERROR_BUBBLE_VIEW_ACCEPT)); |
109 #endif | |
110 } | 85 } |
111 } | 86 } |
112 break; | 87 break; |
113 case AuthError::SERVICE_UNAVAILABLE: | 88 case AuthError::SERVICE_UNAVAILABLE: |
114 if (status_label) { | 89 if (status_label) { |
115 status_label->assign( | 90 status_label->assign( |
116 l10n_util::GetStringUTF16(IDS_SYNC_SERVICE_UNAVAILABLE)); | 91 l10n_util::GetStringUTF16(IDS_SYNC_SERVICE_UNAVAILABLE)); |
117 } | 92 } |
118 if (link_label) | 93 if (link_label) |
119 link_label->clear(); | 94 link_label->clear(); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 } | 794 } |
820 } else { | 795 } else { |
821 version_modifier = " " + version_modifier; | 796 version_modifier = " " + version_modifier; |
822 } | 797 } |
823 return chrome_version.Name() + " " + chrome_version.OSType() + " " + | 798 return chrome_version.Name() + " " + chrome_version.OSType() + " " + |
824 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" + | 799 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" + |
825 version_modifier; | 800 version_modifier; |
826 } | 801 } |
827 | 802 |
828 } // namespace sync_ui_util | 803 } // namespace sync_ui_util |
OLD | NEW |