OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/webui/signin/signin_error_ui.h" | 5 #include "chrome/browser/ui/webui/signin/signin_error_ui.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (gaia::AreEmailsSame(base::UTF16ToUTF8(email), | 90 if (gaia::AreEmailsSame(base::UTF16ToUTF8(email), |
91 base::UTF16ToUTF8(entry->GetUserName()))) { | 91 base::UTF16ToUTF8(entry->GetUserName()))) { |
92 handler->set_duplicate_profile_entry(entry); | 92 handler->set_duplicate_profile_entry(entry); |
93 existing_name = entry->GetName(); | 93 existing_name = entry->GetName(); |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 DCHECK(!existing_name.empty()); | 97 DCHECK(!existing_name.empty()); |
98 source->AddString( | 98 source->AddString( |
99 "signinErrorMessage", | 99 "signinErrorMessage", |
100 l10n_util::GetStringFUTF16( | 100 l10n_util::GetStringFUTF16(IDS_SYNC_USER_NAME_IN_USE_BY_ERROR, |
101 IDS_SIGNIN_ERROR_LEARN_MORE_LINK, | 101 existing_name)); |
102 l10n_util::GetStringFUTF16(IDS_SYNC_USER_NAME_IN_USE_BY_ERROR, | |
103 existing_name))); | |
104 // Elide the existing name for the switch user button label. | 102 // Elide the existing name for the switch user button label. |
105 existing_name = | 103 existing_name = |
106 gfx::TruncateString(existing_name, 10, gfx::CHARACTER_BREAK); | 104 gfx::TruncateString(existing_name, 10, gfx::CHARACTER_BREAK); |
107 } else { | 105 } else { |
108 source->AddString("signinErrorMessage", | 106 source->AddString("signinErrorMessage", last_login_result); |
109 l10n_util::GetStringFUTF16( | |
110 IDS_SIGNIN_ERROR_LEARN_MORE_LINK, last_login_result)); | |
111 } | 107 } |
112 | 108 |
113 // Add button label strings. | 109 // Add button label strings. |
114 source->AddString("signinErrorSwitchLabel", | 110 source->AddString("signinErrorSwitchLabel", |
115 l10n_util::GetStringFUTF16( | 111 l10n_util::GetStringFUTF16( |
116 IDS_SIGNIN_ERROR_SWITCH_BUTTON_LABEL, existing_name)); | 112 IDS_SIGNIN_ERROR_SWITCH_BUTTON_LABEL, existing_name)); |
| 113 source->AddLocalizedString("signinErrorLearnMore", |
| 114 IDS_SIGNIN_ERROR_LEARN_MORE_LINK); |
117 source->AddLocalizedString("signinErrorCloseLabel", | 115 source->AddLocalizedString("signinErrorCloseLabel", |
118 IDS_SIGNIN_ERROR_CLOSE_BUTTON_LABEL); | 116 IDS_SIGNIN_ERROR_CLOSE_BUTTON_LABEL); |
119 source->AddLocalizedString("signinErrorOkLabel", | 117 source->AddLocalizedString("signinErrorOkLabel", |
120 IDS_SIGNIN_ERROR_OK_BUTTON_LABEL); | 118 IDS_SIGNIN_ERROR_OK_BUTTON_LABEL); |
121 | 119 |
122 base::DictionaryValue strings; | 120 base::DictionaryValue strings; |
123 webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(), | 121 webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(), |
124 &strings); | 122 &strings); |
125 source->AddLocalizedStrings(strings); | 123 source->AddLocalizedStrings(strings); |
126 | 124 |
127 content::WebUIDataSource::Add(webui_profile, source); | 125 content::WebUIDataSource::Add(webui_profile, source); |
128 web_ui->AddMessageHandler(handler); | 126 web_ui->AddMessageHandler(handler); |
129 } | 127 } |
OLD | NEW |