| 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/printing/cloud_print/cloud_print_setup_source.h" | 5 #include "chrome/browser/printing/cloud_print/cloud_print_setup_source.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 AddString(dict, "anywhereheader", IDS_CLOUD_PRINT_SETUP_ANYWHERE_HEADER); | 68 AddString(dict, "anywhereheader", IDS_CLOUD_PRINT_SETUP_ANYWHERE_HEADER); |
| 69 AddString(dict, "anywhereexplain", IDS_CLOUD_PRINT_SETUP_ANYWHERE_EXPLAIN); | 69 AddString(dict, "anywhereexplain", IDS_CLOUD_PRINT_SETUP_ANYWHERE_EXPLAIN); |
| 70 AddString(dict, "printerheader", IDS_CLOUD_PRINT_SETUP_PRINTER_HEADER); | 70 AddString(dict, "printerheader", IDS_CLOUD_PRINT_SETUP_PRINTER_HEADER); |
| 71 AddString(dict, "printerexplain", IDS_CLOUD_PRINT_SETUP_PRINTER_EXPLAIN); | 71 AddString(dict, "printerexplain", IDS_CLOUD_PRINT_SETUP_PRINTER_EXPLAIN); |
| 72 AddString(dict, "sharingheader", IDS_CLOUD_PRINT_SETUP_SHARING_HEADER); | 72 AddString(dict, "sharingheader", IDS_CLOUD_PRINT_SETUP_SHARING_HEADER); |
| 73 AddString(dict, "sharingexplain", IDS_CLOUD_PRINT_SETUP_SHARING_EXPLAIN); | 73 AddString(dict, "sharingexplain", IDS_CLOUD_PRINT_SETUP_SHARING_EXPLAIN); |
| 74 | 74 |
| 75 static const base::StringPiece html(ResourceBundle::GetSharedInstance() | 75 static const base::StringPiece html(ResourceBundle::GetSharedInstance() |
| 76 .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_LOGIN_HTML)); | 76 .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_LOGIN_HTML)); |
| 77 web_ui_util::SetFontAndTextDirection(dict); | 77 web_ui_util::SetFontAndTextDirection(dict); |
| 78 response = jstemplate_builder::GetI18nTemplateHtml(html, dict); | 78 response = webui::GetI18nTemplateHtml(html, dict); |
| 79 } else if (path_raw == kCloudPrintGaiaLoginPath) { | 79 } else if (path_raw == kCloudPrintGaiaLoginPath) { |
| 80 // Start by setting the per-locale URLs we show on the setup wizard. | 80 // Start by setting the per-locale URLs we show on the setup wizard. |
| 81 dict->SetString("invalidpasswordhelpurl", | 81 dict->SetString("invalidpasswordhelpurl", |
| 82 GetLocalizedUrl(kInvalidPasswordHelpUrl)); | 82 GetLocalizedUrl(kInvalidPasswordHelpUrl)); |
| 83 dict->SetString("cannotaccessaccounturl", | 83 dict->SetString("cannotaccessaccounturl", |
| 84 GetLocalizedUrl(kCanNotAccessAccountUrl)); | 84 GetLocalizedUrl(kCanNotAccessAccountUrl)); |
| 85 dict->SetString("createnewaccounturl", | 85 dict->SetString("createnewaccounturl", |
| 86 GetLocalizedUrl(kCreateNewAccountUrl)); | 86 GetLocalizedUrl(kCreateNewAccountUrl)); |
| 87 | 87 |
| 88 // None of the strings used here currently have sync-specific wording in | 88 // None of the strings used here currently have sync-specific wording in |
| (...skipping 15 matching lines...) Expand all Loading... |
| 104 AddString(dict, "errorsigningin", IDS_SYNC_ERROR_SIGNING_IN); | 104 AddString(dict, "errorsigningin", IDS_SYNC_ERROR_SIGNING_IN); |
| 105 AddString(dict, "captchainstructions", IDS_SYNC_GAIA_CAPTCHA_INSTRUCTIONS); | 105 AddString(dict, "captchainstructions", IDS_SYNC_GAIA_CAPTCHA_INSTRUCTIONS); |
| 106 AddString(dict, "invalidaccesscode", IDS_SYNC_INVALID_ACCESS_CODE_LABEL); | 106 AddString(dict, "invalidaccesscode", IDS_SYNC_INVALID_ACCESS_CODE_LABEL); |
| 107 AddString(dict, "enteraccesscode", IDS_SYNC_ENTER_ACCESS_CODE_LABEL); | 107 AddString(dict, "enteraccesscode", IDS_SYNC_ENTER_ACCESS_CODE_LABEL); |
| 108 AddString(dict, "getaccesscodehelp", IDS_SYNC_ACCESS_CODE_HELP_LABEL); | 108 AddString(dict, "getaccesscodehelp", IDS_SYNC_ACCESS_CODE_HELP_LABEL); |
| 109 AddString(dict, "getaccesscodeurl", IDS_SYNC_GET_ACCESS_CODE_URL); | 109 AddString(dict, "getaccesscodeurl", IDS_SYNC_GET_ACCESS_CODE_URL); |
| 110 | 110 |
| 111 static const base::StringPiece html(ResourceBundle::GetSharedInstance() | 111 static const base::StringPiece html(ResourceBundle::GetSharedInstance() |
| 112 .GetRawDataResource(IDR_GAIA_LOGIN_HTML)); | 112 .GetRawDataResource(IDR_GAIA_LOGIN_HTML)); |
| 113 web_ui_util::SetFontAndTextDirection(dict); | 113 web_ui_util::SetFontAndTextDirection(dict); |
| 114 response = jstemplate_builder::GetI18nTemplateHtml(html, dict); | 114 response = webui::GetI18nTemplateHtml(html, dict); |
| 115 } else if (path_raw == kCloudPrintSetupDonePath) { | 115 } else if (path_raw == kCloudPrintSetupDonePath) { |
| 116 AddString(dict, "testpage", IDS_CLOUD_PRINT_SETUP_TEST_PAGE); | 116 AddString(dict, "testpage", IDS_CLOUD_PRINT_SETUP_TEST_PAGE); |
| 117 AddString(dict, "success", IDS_SYNC_SUCCESS); | 117 AddString(dict, "success", IDS_SYNC_SUCCESS); |
| 118 AddString(dict, "okay", IDS_SYNC_SETUP_OK_BUTTON_LABEL); | 118 AddString(dict, "okay", IDS_SYNC_SETUP_OK_BUTTON_LABEL); |
| 119 static const base::StringPiece html(ResourceBundle::GetSharedInstance() | 119 static const base::StringPiece html(ResourceBundle::GetSharedInstance() |
| 120 .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_DONE_HTML)); | 120 .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_DONE_HTML)); |
| 121 web_ui_util::SetFontAndTextDirection(dict); | 121 web_ui_util::SetFontAndTextDirection(dict); |
| 122 response = jstemplate_builder::GetI18nTemplateHtml(html, dict); | 122 response = webui::GetI18nTemplateHtml(html, dict); |
| 123 } else if (path_raw == kCloudPrintSetupFlowPath) { | 123 } else if (path_raw == kCloudPrintSetupFlowPath) { |
| 124 static const base::StringPiece html( | 124 static const base::StringPiece html( |
| 125 ResourceBundle::GetSharedInstance() | 125 ResourceBundle::GetSharedInstance() |
| 126 .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_FLOW_HTML)); | 126 .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_FLOW_HTML)); |
| 127 response = html.as_string(); | 127 response = html.as_string(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 callback.Run(base::RefCountedString::TakeString(&response)); | 130 callback.Run(base::RefCountedString::TakeString(&response)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 std::string CloudPrintSetupSource::GetMimeType(const std::string& path) const { | 133 std::string CloudPrintSetupSource::GetMimeType(const std::string& path) const { |
| 134 return "text/html"; | 134 return "text/html"; |
| 135 } | 135 } |
| 136 | 136 |
| 137 std::string CloudPrintSetupSource::GetLocalizedUrl( | 137 std::string CloudPrintSetupSource::GetLocalizedUrl( |
| 138 const std::string& url) const { | 138 const std::string& url) const { |
| 139 GURL original_url(url); | 139 GURL original_url(url); |
| 140 DCHECK(original_url.is_valid()); | 140 DCHECK(original_url.is_valid()); |
| 141 GURL localized_url = google_util::AppendGoogleLocaleParam(original_url); | 141 GURL localized_url = google_util::AppendGoogleLocaleParam(original_url); |
| 142 return localized_url.spec(); | 142 return localized_url.spec(); |
| 143 } | 143 } |
| OLD | NEW |