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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 8589014: [Sync Setup] Change the "sync everything" dialog "Learn more" link. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/sync_setup_overlay.html ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/sync_setup_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 20 matching lines...) Expand all
31 #include "grit/chromium_strings.h" 31 #include "grit/chromium_strings.h"
32 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
33 #include "grit/locale_settings.h" 33 #include "grit/locale_settings.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 35
36 using l10n_util::GetStringFUTF16; 36 using l10n_util::GetStringFUTF16;
37 using l10n_util::GetStringUTF16; 37 using l10n_util::GetStringUTF16;
38 38
39 namespace { 39 namespace {
40 40
41 // TODO(jhawkins): Move these to url_constants.h.
42 const char* kInvalidPasswordHelpUrl =
43 "http://www.google.com/support/accounts/bin/answer.py?ctx=ch&answer=27444";
44 const char* kCanNotAccessAccountUrl =
45 "http://www.google.com/support/accounts/bin/answer.py?answer=48598";
46 #if defined(OS_CHROMEOS)
47 const char* kEncryptionHelpUrl =
48 "http://www.google.com/support/chromeos/bin/answer.py?answer=1181035";
49 #else
50 const char* kEncryptionHelpUrl =
51 "http://www.google.com/support/chrome/bin/answer.py?answer=1181035";
52 #endif
53 const char* kCreateNewAccountUrl =
54 "https://www.google.com/accounts/NewAccount?service=chromiumsync";
55
56 bool GetAuthData(const std::string& json, 41 bool GetAuthData(const std::string& json,
57 std::string* username, 42 std::string* username,
58 std::string* password, 43 std::string* password,
59 std::string* captcha, 44 std::string* captcha,
60 std::string* access_code) { 45 std::string* access_code) {
61 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); 46 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
62 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) 47 if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
63 return false; 48 return false;
64 49
65 DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get()); 50 DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get());
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 void SyncSetupHandler::GetLocalizedValues(DictionaryValue* localized_strings) { 244 void SyncSetupHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
260 GetStaticLocalizedValues(localized_strings); 245 GetStaticLocalizedValues(localized_strings);
261 } 246 }
262 247
263 void SyncSetupHandler::GetStaticLocalizedValues( 248 void SyncSetupHandler::GetStaticLocalizedValues(
264 DictionaryValue* localized_strings) { 249 DictionaryValue* localized_strings) {
265 DCHECK(localized_strings); 250 DCHECK(localized_strings);
266 251
267 localized_strings->SetString( 252 localized_strings->SetString(
268 "invalidPasswordHelpURL", 253 "invalidPasswordHelpURL",
269 google_util::StringAppendGoogleLocaleParam(kInvalidPasswordHelpUrl)); 254 google_util::StringAppendGoogleLocaleParam(
255 chrome::kInvalidPasswordHelpURL));
270 localized_strings->SetString( 256 localized_strings->SetString(
271 "cannotAccessAccountURL", 257 "cannotAccessAccountURL",
272 google_util::StringAppendGoogleLocaleParam(kCanNotAccessAccountUrl)); 258 google_util::StringAppendGoogleLocaleParam(
259 chrome::kCanNotAccessAccountURL));
273 localized_strings->SetString( 260 localized_strings->SetString(
274 "introduction", 261 "introduction",
275 GetStringFUTF16(IDS_SYNC_LOGIN_INTRODUCTION, 262 GetStringFUTF16(IDS_SYNC_LOGIN_INTRODUCTION,
276 GetStringUTF16(IDS_PRODUCT_NAME))); 263 GetStringUTF16(IDS_PRODUCT_NAME)));
277 localized_strings->SetString( 264 localized_strings->SetString(
278 "chooseDataTypesInstructions", 265 "chooseDataTypesInstructions",
279 GetStringFUTF16(IDS_SYNC_CHOOSE_DATATYPES_INSTRUCTIONS, 266 GetStringFUTF16(IDS_SYNC_CHOOSE_DATATYPES_INSTRUCTIONS,
280 GetStringUTF16(IDS_PRODUCT_NAME))); 267 GetStringUTF16(IDS_PRODUCT_NAME)));
281 localized_strings->SetString( 268 localized_strings->SetString(
282 "encryptionInstructions", 269 "encryptionInstructions",
283 GetStringFUTF16(IDS_SYNC_ENCRYPTION_INSTRUCTIONS, 270 GetStringFUTF16(IDS_SYNC_ENCRYPTION_INSTRUCTIONS,
284 GetStringUTF16(IDS_PRODUCT_NAME))); 271 GetStringUTF16(IDS_PRODUCT_NAME)));
285 localized_strings->SetString( 272 localized_strings->SetString(
286 "encryptionHelpURL", 273 "encryptionHelpURL",
287 google_util::StringAppendGoogleLocaleParam(kEncryptionHelpUrl)); 274 google_util::StringAppendGoogleLocaleParam(
275 chrome::kSyncEncryptionHelpURL));
288 localized_strings->SetString( 276 localized_strings->SetString(
289 "passphraseEncryptionMessage", 277 "passphraseEncryptionMessage",
290 GetStringFUTF16(IDS_SYNC_PASSPHRASE_ENCRYPTION_MESSAGE, 278 GetStringFUTF16(IDS_SYNC_PASSPHRASE_ENCRYPTION_MESSAGE,
291 GetStringUTF16(IDS_PRODUCT_NAME))); 279 GetStringUTF16(IDS_PRODUCT_NAME)));
292 localized_strings->SetString( 280 localized_strings->SetString(
293 "passphraseRecover", 281 "passphraseRecover",
294 GetStringFUTF16(IDS_SYNC_PASSPHRASE_RECOVER, 282 GetStringFUTF16(IDS_SYNC_PASSPHRASE_RECOVER,
295 ASCIIToUTF16(google_util::StringAppendGoogleLocaleParam( 283 ASCIIToUTF16(google_util::StringAppendGoogleLocaleParam(
296 chrome::kSyncGoogleDashboardURL)))); 284 chrome::kSyncGoogleDashboardURL))));
297 localized_strings->SetString( 285 localized_strings->SetString(
298 "promoTitle", 286 "promoTitle",
299 GetStringFUTF16(IDS_SYNC_PROMO_TITLE, 287 GetStringFUTF16(IDS_SYNC_PROMO_TITLE,
300 GetStringUTF16(IDS_PRODUCT_NAME))); 288 GetStringUTF16(IDS_PRODUCT_NAME)));
301 localized_strings->SetString( 289 localized_strings->SetString(
302 "promoMessageTitle", 290 "promoMessageTitle",
303 GetStringFUTF16(IDS_SYNC_PROMO_MESSAGE_TITLE, 291 GetStringFUTF16(IDS_SYNC_PROMO_MESSAGE_TITLE,
304 GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); 292 GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
293 localized_strings->SetString(
294 "syncEverythingHelpURL",
295 google_util::StringAppendGoogleLocaleParam(
296 chrome::kSyncEverythingLearnMoreURL));
305 297
306 std::string create_account_url = 298 std::string create_account_url = google_util::StringAppendGoogleLocaleParam(
James Hawkins 2011/11/17 21:39:07 nit: Remove extra space at EOL.
307 google_util::StringAppendGoogleLocaleParam(kCreateNewAccountUrl); 299 chrome::kSyncCreateNewAccountURL);
308 string16 create_account = GetStringUTF16(IDS_SYNC_CREATE_ACCOUNT); 300 string16 create_account = GetStringUTF16(IDS_SYNC_CREATE_ACCOUNT);
309 create_account= UTF8ToUTF16("<a id='create-account-link' target='_blank' " 301 create_account= UTF8ToUTF16("<a id='create-account-link' target='_blank' "
310 "class='account-link' href='" + create_account_url + "'>") + 302 "class='account-link' href='" + create_account_url + "'>") +
311 create_account + UTF8ToUTF16("</a>"); 303 create_account + UTF8ToUTF16("</a>");
312 localized_strings->SetString("createAccountLinkHTML", 304 localized_strings->SetString("createAccountLinkHTML",
313 GetStringFUTF16(IDS_SYNC_CREATE_ACCOUNT_PREFIX, create_account)); 305 GetStringFUTF16(IDS_SYNC_CREATE_ACCOUNT_PREFIX, create_account));
314 306
315 static OptionsStringResource resources[] = { 307 static OptionsStringResource resources[] = {
316 { "syncSetupOverlayTitle", IDS_SYNC_SETUP_TITLE }, 308 { "syncSetupOverlayTitle", IDS_SYNC_SETUP_TITLE },
317 { "syncSetupConfigureTitle", IDS_SYNC_SETUP_CONFIGURE_TITLE }, 309 { "syncSetupConfigureTitle", IDS_SYNC_SETUP_CONFIGURE_TITLE },
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 736 }
745 737
746 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { 738 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) {
747 DictionaryValue args; 739 DictionaryValue args;
748 Profile* profile = Profile::FromWebUI(web_ui_); 740 Profile* profile = Profile::FromWebUI(web_ui_);
749 ProfileSyncService* service = profile->GetProfileSyncService(); 741 ProfileSyncService* service = profile->GetProfileSyncService();
750 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); 742 SyncSetupFlow::GetArgsForGaiaLogin(service, &args);
751 args.SetString("error_message", error_message); 743 args.SetString("error_message", error_message);
752 ShowGaiaLogin(args); 744 ShowGaiaLogin(args);
753 } 745 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/sync_setup_overlay.html ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698