| 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/sync/sync_setup_wizard.h" | 5 #include "chrome/browser/sync/sync_setup_wizard.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 bool is_off_the_record, | 44 bool is_off_the_record, |
| 45 int request_id); | 45 int request_id); |
| 46 | 46 |
| 47 virtual std::string GetMimeType(const std::string& path) const { | 47 virtual std::string GetMimeType(const std::string& path) const { |
| 48 return "text/html"; | 48 return "text/html"; |
| 49 } | 49 } |
| 50 | 50 |
| 51 static const char* kInvalidPasswordHelpUrl; | 51 static const char* kInvalidPasswordHelpUrl; |
| 52 static const char* kCanNotAccessAccountUrl; | 52 static const char* kCanNotAccessAccountUrl; |
| 53 static const char* kCreateNewAccountUrl; | 53 static const char* kCreateNewAccountUrl; |
| 54 static const char* kEncryptionHelpUrl; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 virtual ~SyncResourcesSource() {} | 57 virtual ~SyncResourcesSource() {} |
| 57 | 58 |
| 58 // Takes a string containing an URL and returns an URL containing a CGI | 59 // Takes a string containing an URL and returns an URL containing a CGI |
| 59 // parameter of the form "&hl=xy" where 'xy' is the language code of the | 60 // parameter of the form "&hl=xy" where 'xy' is the language code of the |
| 60 // current locale. | 61 // current locale. |
| 61 std::string GetLocalizedUrl(const std::string& url) const; | 62 std::string GetLocalizedUrl(const std::string& url) const; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(SyncResourcesSource); | 64 DISALLOW_COPY_AND_ASSIGN(SyncResourcesSource); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 const char* SyncResourcesSource::kInvalidPasswordHelpUrl = | 67 const char* SyncResourcesSource::kInvalidPasswordHelpUrl = |
| 67 "http://www.google.com/support/accounts/bin/answer.py?ctx=ch&answer=27444"; | 68 "http://www.google.com/support/accounts/bin/answer.py?ctx=ch&answer=27444"; |
| 68 const char* SyncResourcesSource::kCanNotAccessAccountUrl = | 69 const char* SyncResourcesSource::kCanNotAccessAccountUrl = |
| 69 "http://www.google.com/support/accounts/bin/answer.py?answer=48598"; | 70 "http://www.google.com/support/accounts/bin/answer.py?answer=48598"; |
| 71 const char* SyncResourcesSource::kEncryptionHelpUrl = |
| 72 "http://www.google.com/support/chrome/bin/answer.py?answer=165139"; |
| 70 const char* SyncResourcesSource::kCreateNewAccountUrl = | 73 const char* SyncResourcesSource::kCreateNewAccountUrl = |
| 71 "https://www.google.com/accounts/NewAccount?service=chromiumsync"; | 74 "https://www.google.com/accounts/NewAccount?service=chromiumsync"; |
| 72 | 75 |
| 73 void SyncResourcesSource::StartDataRequest(const std::string& path_raw, | 76 void SyncResourcesSource::StartDataRequest(const std::string& path_raw, |
| 74 bool is_off_the_record, int request_id) { | 77 bool is_off_the_record, int request_id) { |
| 75 using l10n_util::GetStringUTF16; | 78 using l10n_util::GetStringUTF16; |
| 76 using l10n_util::GetStringFUTF16; | 79 using l10n_util::GetStringFUTF16; |
| 77 | 80 |
| 78 const char kSyncSetupFlowPath[] = "setup"; | 81 const char kSyncSetupFlowPath[] = "setup"; |
| 79 const char kSyncGaiaLoginPath[] = "gaialogin"; | 82 const char kSyncGaiaLoginPath[] = "gaialogin"; |
| 80 const char kSyncConfigurePath[] = "configure"; | 83 const char kSyncConfigurePath[] = "configure"; |
| 81 const char kSyncPassphrasePath[] = "passphrase"; | 84 const char kSyncPassphrasePath[] = "passphrase"; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 AddString(dict, "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT); | 160 AddString(dict, "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT); |
| 158 AddString(dict, "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL); | 161 AddString(dict, "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL); |
| 159 AddString(dict, "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL); | 162 AddString(dict, "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL); |
| 160 AddString(dict, "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR); | 163 AddString(dict, "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR); |
| 161 AddString(dict, "mismatchErrorMessage", IDS_SYNC_PASSPHRASE_MISMATCH_ERROR); | 164 AddString(dict, "mismatchErrorMessage", IDS_SYNC_PASSPHRASE_MISMATCH_ERROR); |
| 162 | 165 |
| 163 AddString(dict, "passphraseWarning", IDS_SYNC_PASSPHRASE_WARNING); | 166 AddString(dict, "passphraseWarning", IDS_SYNC_PASSPHRASE_WARNING); |
| 164 AddString(dict, "cleardata", IDS_SYNC_CLEAR_DATA_FOR_PASSPHRASE); | 167 AddString(dict, "cleardata", IDS_SYNC_CLEAR_DATA_FOR_PASSPHRASE); |
| 165 AddString(dict, "cleardatalink", IDS_SYNC_CLEAR_DATA_LINK); | 168 AddString(dict, "cleardatalink", IDS_SYNC_CLEAR_DATA_LINK); |
| 166 | 169 |
| 170 AddString(dict, "learnmore", IDS_LEARN_MORE); |
| 171 dict->SetString("encryptionhelpurl", |
| 172 GetLocalizedUrl(kEncryptionHelpUrl)); |
| 173 |
| 167 // Stuff for the footer. | 174 // Stuff for the footer. |
| 168 AddString(dict, "ok", IDS_OK); | 175 AddString(dict, "ok", IDS_OK); |
| 169 AddString(dict, "cancel", IDS_CANCEL); | 176 AddString(dict, "cancel", IDS_CANCEL); |
| 170 } else if (path_raw == kSyncPassphrasePath) { | 177 } else if (path_raw == kSyncPassphrasePath) { |
| 171 html_resource_id = IDR_SYNC_PASSPHRASE_HTML; | 178 html_resource_id = IDR_SYNC_PASSPHRASE_HTML; |
| 172 AddString(dict, "enterPassphraseTitle", IDS_SYNC_ENTER_PASSPHRASE_TITLE); | 179 AddString(dict, "enterPassphraseTitle", IDS_SYNC_ENTER_PASSPHRASE_TITLE); |
| 173 AddString(dict, "enterPassphraseBody", IDS_SYNC_ENTER_PASSPHRASE_BODY); | 180 AddString(dict, "enterPassphraseBody", IDS_SYNC_ENTER_PASSPHRASE_BODY); |
| 174 AddString(dict, "enterOtherPassphraseBody", | 181 AddString(dict, "enterOtherPassphraseBody", |
| 175 IDS_SYNC_ENTER_OTHER_PASSPHRASE_BODY); | 182 IDS_SYNC_ENTER_OTHER_PASSPHRASE_BODY); |
| 176 AddString(dict, "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL); | 183 AddString(dict, "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 result = GAIA_SUCCESS; | 321 result = GAIA_SUCCESS; |
| 315 } else if (start_state == ENTER_PASSPHRASE || | 322 } else if (start_state == ENTER_PASSPHRASE || |
| 316 start_state == CONFIGURE || | 323 start_state == CONFIGURE || |
| 317 start_state == PASSPHRASE_MIGRATION) { | 324 start_state == PASSPHRASE_MIGRATION) { |
| 318 result = DONE; | 325 result = DONE; |
| 319 } | 326 } |
| 320 DCHECK_NE(FATAL_ERROR, result) << | 327 DCHECK_NE(FATAL_ERROR, result) << |
| 321 "Invalid start state for discrete run: " << start_state; | 328 "Invalid start state for discrete run: " << start_state; |
| 322 return result; | 329 return result; |
| 323 } | 330 } |
| OLD | NEW |