| 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/ui/webui/chromeos/keyboard_overlay_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ChromeWebUIDataSource* source = | 204 ChromeWebUIDataSource* source = |
| 205 new ChromeWebUIDataSource(chrome::kChromeUIKeyboardOverlayHost); | 205 new ChromeWebUIDataSource(chrome::kChromeUIKeyboardOverlayHost); |
| 206 | 206 |
| 207 for (size_t i = 0; i < arraysize(kI18nContentToMessage); ++i) { | 207 for (size_t i = 0; i < arraysize(kI18nContentToMessage); ++i) { |
| 208 source->AddLocalizedString(kI18nContentToMessage[i].i18n_content, | 208 source->AddLocalizedString(kI18nContentToMessage[i].i18n_content, |
| 209 kI18nContentToMessage[i].message); | 209 kI18nContentToMessage[i].message); |
| 210 } | 210 } |
| 211 | 211 |
| 212 source->AddString("keyboardOverlayLearnMoreURL", UTF8ToUTF16(kLearnMoreURL)); | 212 source->AddString("keyboardOverlayLearnMoreURL", UTF8ToUTF16(kLearnMoreURL)); |
| 213 source->set_json_path("strings.js"); | 213 source->set_json_path("strings.js"); |
| 214 source->set_use_json_js_format_v2(); |
| 214 source->add_resource_path("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS); | 215 source->add_resource_path("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS); |
| 215 source->set_default_resource(IDR_KEYBOARD_OVERLAY_HTML); | 216 source->set_default_resource(IDR_KEYBOARD_OVERLAY_HTML); |
| 216 return source; | 217 return source; |
| 217 } | 218 } |
| 218 | 219 |
| 219 } // namespace | 220 } // namespace |
| 220 | 221 |
| 221 // The handler for Javascript messages related to the "keyboardoverlay" view. | 222 // The handler for Javascript messages related to the "keyboardoverlay" view. |
| 222 class KeyboardOverlayHandler | 223 class KeyboardOverlayHandler |
| 223 : public WebUIMessageHandler, | 224 : public WebUIMessageHandler, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) | 318 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) |
| 318 : WebDialogUI(web_ui) { | 319 : WebDialogUI(web_ui) { |
| 319 Profile* profile = Profile::FromWebUI(web_ui); | 320 Profile* profile = Profile::FromWebUI(web_ui); |
| 320 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); | 321 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); |
| 321 web_ui->AddMessageHandler(handler); | 322 web_ui->AddMessageHandler(handler); |
| 322 | 323 |
| 323 // Set up the chrome://keyboardoverlay/ source. | 324 // Set up the chrome://keyboardoverlay/ source. |
| 324 ChromeURLDataManager::AddDataSource(profile, | 325 ChromeURLDataManager::AddDataSource(profile, |
| 325 CreateKeyboardOverlayUIHTMLSource()); | 326 CreateKeyboardOverlayUIHTMLSource()); |
| 326 } | 327 } |
| OLD | NEW |