| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/feature_list.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/common/chrome_features.h" |
| 19 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/grit/chromium_strings.h" | 23 #include "chrome/grit/chromium_strings.h" |
| 22 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
| 23 #include "chromeos/chromeos_switches.h" | 25 #include "chromeos/chromeos_switches.h" |
| 24 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
| 25 #include "content/public/browser/page_navigator.h" | 27 #include "content/public/browser/page_navigator.h" |
| 26 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/browser/web_contents_delegate.h" | 29 #include "content/public/browser/web_contents_delegate.h" |
| 28 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 base::UTF8ToUTF16(kLearnMoreURL)); | 302 base::UTF8ToUTF16(kLearnMoreURL)); |
| 301 source->AddBoolean("keyboardOverlayHasChromeOSDiamondKey", | 303 source->AddBoolean("keyboardOverlayHasChromeOSDiamondKey", |
| 302 base::CommandLine::ForCurrentProcess()->HasSwitch( | 304 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 303 chromeos::switches::kHasChromeOSDiamondKey)); | 305 chromeos::switches::kHasChromeOSDiamondKey)); |
| 304 source->AddBoolean("keyboardOverlayTopRowKeysAreFunctionKeys", | 306 source->AddBoolean("keyboardOverlayTopRowKeysAreFunctionKeys", |
| 305 TopRowKeysAreFunctionKeys(profile)); | 307 TopRowKeysAreFunctionKeys(profile)); |
| 306 ash::Shell* shell = ash::Shell::GetInstance(); | 308 ash::Shell* shell = ash::Shell::GetInstance(); |
| 307 ash::DisplayManager* display_manager = shell->display_manager(); | 309 ash::DisplayManager* display_manager = shell->display_manager(); |
| 308 source->AddBoolean("keyboardOverlayIsDisplayUIScalingEnabled", | 310 source->AddBoolean("keyboardOverlayIsDisplayUIScalingEnabled", |
| 309 display_manager->IsDisplayUIScalingEnabled()); | 311 display_manager->IsDisplayUIScalingEnabled()); |
| 312 source->AddBoolean( |
| 313 "backspaceGoesBackFeatureEnabled", |
| 314 base::FeatureList::IsEnabled(features::kBackspaceGoesBackFeature)); |
| 310 source->SetJsonPath("strings.js"); | 315 source->SetJsonPath("strings.js"); |
| 311 source->AddResourcePath("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS); | 316 source->AddResourcePath("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS); |
| 312 source->SetDefaultResource(IDR_KEYBOARD_OVERLAY_HTML); | 317 source->SetDefaultResource(IDR_KEYBOARD_OVERLAY_HTML); |
| 313 return source; | 318 return source; |
| 314 } | 319 } |
| 315 | 320 |
| 316 } // namespace | 321 } // namespace |
| 317 | 322 |
| 318 // The handler for Javascript messages related to the "keyboardoverlay" view. | 323 // The handler for Javascript messages related to the "keyboardoverlay" view. |
| 319 class KeyboardOverlayHandler | 324 class KeyboardOverlayHandler |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) | 423 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) |
| 419 : WebDialogUI(web_ui) { | 424 : WebDialogUI(web_ui) { |
| 420 Profile* profile = Profile::FromWebUI(web_ui); | 425 Profile* profile = Profile::FromWebUI(web_ui); |
| 421 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); | 426 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); |
| 422 web_ui->AddMessageHandler(handler); | 427 web_ui->AddMessageHandler(handler); |
| 423 | 428 |
| 424 // Set up the chrome://keyboardoverlay/ source. | 429 // Set up the chrome://keyboardoverlay/ source. |
| 425 content::WebUIDataSource::Add(profile, | 430 content::WebUIDataSource::Add(profile, |
| 426 CreateKeyboardOverlayUIHTMLSource(profile)); | 431 CreateKeyboardOverlayUIHTMLSource(profile)); |
| 427 } | 432 } |
| OLD | NEW |