OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/remoting/remoting_resources_source.h" | 5 #include "chrome/browser/remoting/remoting_resources_source.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/google/google_util.h" | 15 #include "chrome/browser/google/google_util.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 #include "grit/app_resources.h" | 19 #include "grit/app_resources.h" |
20 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 23 #include "grit/locale_settings.h" |
23 | 24 |
24 // Define the values of standard URLs. | 25 // Define the values of standard URLs. |
25 const char RemotingResourcesSource::kInvalidPasswordHelpUrl[] = | 26 const char RemotingResourcesSource::kInvalidPasswordHelpUrl[] = |
26 "http://www.google.com/support/accounts/bin/answer.py?ctx=ch&answer=27444"; | 27 "http://www.google.com/support/accounts/bin/answer.py?ctx=ch&answer=27444"; |
27 const char RemotingResourcesSource::kCanNotAccessAccountUrl[] = | 28 const char RemotingResourcesSource::kCanNotAccessAccountUrl[] = |
28 "http://www.google.com/support/accounts/bin/answer.py?answer=48598"; | 29 "http://www.google.com/support/accounts/bin/answer.py?answer=48598"; |
29 const char RemotingResourcesSource::kCreateNewAccountUrl[] = | 30 const char RemotingResourcesSource::kCreateNewAccountUrl[] = |
30 "https://www.google.com/accounts/NewAccount?service=chromiumsync"; | 31 "https://www.google.com/accounts/NewAccount?service=chromiumsync"; |
31 | 32 |
32 RemotingResourcesSource::RemotingResourcesSource() | 33 RemotingResourcesSource::RemotingResourcesSource() |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 localized_strings.SetString("cancel", | 81 localized_strings.SetString("cancel", |
81 l10n_util::GetStringUTF16(IDS_CANCEL)); | 82 l10n_util::GetStringUTF16(IDS_CANCEL)); |
82 localized_strings.SetString("settingup", | 83 localized_strings.SetString("settingup", |
83 l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SETTING_UP)); | 84 l10n_util::GetStringUTF16(IDS_SYNC_LOGIN_SETTING_UP)); |
84 localized_strings.SetString("success", | 85 localized_strings.SetString("success", |
85 l10n_util::GetStringUTF16(IDS_SYNC_SUCCESS)); | 86 l10n_util::GetStringUTF16(IDS_SYNC_SUCCESS)); |
86 localized_strings.SetString("errorsigningin", | 87 localized_strings.SetString("errorsigningin", |
87 l10n_util::GetStringUTF16(IDS_SYNC_ERROR_SIGNING_IN)); | 88 l10n_util::GetStringUTF16(IDS_SYNC_ERROR_SIGNING_IN)); |
88 localized_strings.SetString("captchainstructions", | 89 localized_strings.SetString("captchainstructions", |
89 l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_INSTRUCTIONS)); | 90 l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_INSTRUCTIONS)); |
| 91 localized_strings.SetString("invalidaccesscode", |
| 92 l10n_util::GetStringUTF16(IDS_SYNC_INVALID_ACCESS_CODE_LABEL)); |
| 93 localized_strings.SetString("enteraccesscode", |
| 94 l10n_util::GetStringUTF16(IDS_SYNC_ENTER_ACCESS_CODE_LABEL)); |
| 95 localized_strings.SetString("getaccesscodehelp", |
| 96 l10n_util::GetStringUTF16(IDS_SYNC_ACCESS_CODE_HELP_LABEL)); |
| 97 localized_strings.SetString("getaccesscodeurl", |
| 98 l10n_util::GetStringUTF16(IDS_SYNC_GET_ACCESS_CODE_URL)); |
| 99 |
90 static const base::StringPiece html(ResourceBundle::GetSharedInstance() | 100 static const base::StringPiece html(ResourceBundle::GetSharedInstance() |
91 .GetRawDataResource(IDR_GAIA_LOGIN_HTML)); | 101 .GetRawDataResource(IDR_GAIA_LOGIN_HTML)); |
92 SetFontAndTextDirection(&localized_strings); | 102 SetFontAndTextDirection(&localized_strings); |
93 response = jstemplate_builder::GetI18nTemplateHtml( | 103 response = jstemplate_builder::GetI18nTemplateHtml( |
94 html, &localized_strings); | 104 html, &localized_strings); |
95 } else if (path_raw == kRemotingSettingUpPath) { | 105 } else if (path_raw == kRemotingSettingUpPath) { |
96 DictionaryValue localized_strings; | 106 DictionaryValue localized_strings; |
97 localized_strings.SetString("settingup", | 107 localized_strings.SetString("settingup", |
98 l10n_util::GetStringUTF16(IDS_REMOTING_SETTING_UP_MESSAGE)); | 108 l10n_util::GetStringUTF16(IDS_REMOTING_SETTING_UP_MESSAGE)); |
99 localized_strings.SetString("cancel", | 109 localized_strings.SetString("cancel", |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return "text/html"; | 152 return "text/html"; |
143 } | 153 } |
144 | 154 |
145 std::string RemotingResourcesSource::GetLocalizedUrl( | 155 std::string RemotingResourcesSource::GetLocalizedUrl( |
146 const std::string& url) const { | 156 const std::string& url) const { |
147 GURL original_url(url); | 157 GURL original_url(url); |
148 DCHECK(original_url.is_valid()); | 158 DCHECK(original_url.is_valid()); |
149 GURL localized_url = google_util::AppendGoogleLocaleParam(original_url); | 159 GURL localized_url = google_util::AppendGoogleLocaleParam(original_url); |
150 return localized_url.spec(); | 160 return localized_url.spec(); |
151 } | 161 } |
OLD | NEW |