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 "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 source->AddString("keyboardOverlayLearnMoreURL", | 258 source->AddString("keyboardOverlayLearnMoreURL", |
259 base::UTF8ToUTF16(kLearnMoreURL)); | 259 base::UTF8ToUTF16(kLearnMoreURL)); |
260 source->AddBoolean("keyboardOverlayHasChromeOSDiamondKey", | 260 source->AddBoolean("keyboardOverlayHasChromeOSDiamondKey", |
261 CommandLine::ForCurrentProcess()->HasSwitch( | 261 CommandLine::ForCurrentProcess()->HasSwitch( |
262 chromeos::switches::kHasChromeOSDiamondKey)); | 262 chromeos::switches::kHasChromeOSDiamondKey)); |
263 ash::Shell* shell = ash::Shell::GetInstance(); | 263 ash::Shell* shell = ash::Shell::GetInstance(); |
264 ash::DisplayManager* display_manager = shell->display_manager(); | 264 ash::DisplayManager* display_manager = shell->display_manager(); |
265 source->AddBoolean("keyboardOverlayIsDisplayUIScalingEnabled", | 265 source->AddBoolean("keyboardOverlayIsDisplayUIScalingEnabled", |
266 display_manager->IsDisplayUIScalingEnabled()); | 266 display_manager->IsDisplayUIScalingEnabled()); |
267 source->SetJsonPath("strings.js"); | 267 source->SetJsonPath("strings.js"); |
268 source->SetUseJsonJSFormatV2(); | |
269 source->AddResourcePath("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS); | 268 source->AddResourcePath("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS); |
270 source->SetDefaultResource(IDR_KEYBOARD_OVERLAY_HTML); | 269 source->SetDefaultResource(IDR_KEYBOARD_OVERLAY_HTML); |
271 return source; | 270 return source; |
272 } | 271 } |
273 | 272 |
274 } // namespace | 273 } // namespace |
275 | 274 |
276 // The handler for Javascript messages related to the "keyboardoverlay" view. | 275 // The handler for Javascript messages related to the "keyboardoverlay" view. |
277 class KeyboardOverlayHandler | 276 class KeyboardOverlayHandler |
278 : public WebUIMessageHandler, | 277 : public WebUIMessageHandler, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 374 |
376 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) | 375 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) |
377 : WebDialogUI(web_ui) { | 376 : WebDialogUI(web_ui) { |
378 Profile* profile = Profile::FromWebUI(web_ui); | 377 Profile* profile = Profile::FromWebUI(web_ui); |
379 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); | 378 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); |
380 web_ui->AddMessageHandler(handler); | 379 web_ui->AddMessageHandler(handler); |
381 | 380 |
382 // Set up the chrome://keyboardoverlay/ source. | 381 // Set up the chrome://keyboardoverlay/ source. |
383 content::WebUIDataSource::Add(profile, CreateKeyboardOverlayUIHTMLSource()); | 382 content::WebUIDataSource::Add(profile, CreateKeyboardOverlayUIHTMLSource()); |
384 } | 383 } |
OLD | NEW |