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