Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc

Issue 14820030: Move Chrome OS switches to chromeos/chromeos_switches.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 16 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
20 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "chromeos/chromeos_switches.h"
21 #include "chromeos/ime/input_method_manager.h" 21 #include "chromeos/ime/input_method_manager.h"
22 #include "chromeos/ime/xkeyboard.h" 22 #include "chromeos/ime/xkeyboard.h"
23 #include "content/public/browser/page_navigator.h" 23 #include "content/public/browser/page_navigator.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/browser/web_contents_delegate.h" 25 #include "content/public/browser/web_contents_delegate.h"
26 #include "content/public/browser/web_ui.h" 26 #include "content/public/browser/web_ui.h"
27 #include "content/public/browser/web_ui_data_source.h" 27 #include "content/public/browser/web_ui_data_source.h"
28 #include "content/public/browser/web_ui_message_handler.h" 28 #include "content/public/browser/web_ui_message_handler.h"
29 #include "grit/browser_resources.h" 29 #include "grit/browser_resources.h"
30 #include "grit/chromium_strings.h" 30 #include "grit/chromium_strings.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 content::WebUIDataSource::Create(chrome::kChromeUIKeyboardOverlayHost); 248 content::WebUIDataSource::Create(chrome::kChromeUIKeyboardOverlayHost);
249 249
250 for (size_t i = 0; i < arraysize(kI18nContentToMessage); ++i) { 250 for (size_t i = 0; i < arraysize(kI18nContentToMessage); ++i) {
251 source->AddLocalizedString(kI18nContentToMessage[i].i18n_content, 251 source->AddLocalizedString(kI18nContentToMessage[i].i18n_content,
252 kI18nContentToMessage[i].message); 252 kI18nContentToMessage[i].message);
253 } 253 }
254 254
255 source->AddString("keyboardOverlayLearnMoreURL", UTF8ToUTF16(kLearnMoreURL)); 255 source->AddString("keyboardOverlayLearnMoreURL", UTF8ToUTF16(kLearnMoreURL));
256 source->AddBoolean("keyboardOverlayHasChromeOSDiamondKey", 256 source->AddBoolean("keyboardOverlayHasChromeOSDiamondKey",
257 CommandLine::ForCurrentProcess()->HasSwitch( 257 CommandLine::ForCurrentProcess()->HasSwitch(
258 switches::kHasChromeOSDiamondKey)); 258 chromeos::switches::kHasChromeOSDiamondKey));
259 ash::Shell* shell = ash::Shell::GetInstance(); 259 ash::Shell* shell = ash::Shell::GetInstance();
260 ash::internal::DisplayManager* display_manager = shell->display_manager(); 260 ash::internal::DisplayManager* display_manager = shell->display_manager();
261 source->AddBoolean("keyboardOverlayIsDisplayRotationEnabled", 261 source->AddBoolean("keyboardOverlayIsDisplayRotationEnabled",
262 display_manager->IsDisplayRotationEnabled()); 262 display_manager->IsDisplayRotationEnabled());
263 source->AddBoolean("keyboardOverlayIsDisplayUIScalingEnabled", 263 source->AddBoolean("keyboardOverlayIsDisplayUIScalingEnabled",
264 display_manager->IsDisplayUIScalingEnabled()); 264 display_manager->IsDisplayUIScalingEnabled());
265 source->SetJsonPath("strings.js"); 265 source->SetJsonPath("strings.js");
266 source->SetUseJsonJSFormatV2(); 266 source->SetUseJsonJSFormatV2();
267 source->AddResourcePath("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS); 267 source->AddResourcePath("keyboard_overlay.js", IDR_KEYBOARD_OVERLAY_JS);
268 source->SetDefaultResource(IDR_KEYBOARD_OVERLAY_HTML); 268 source->SetDefaultResource(IDR_KEYBOARD_OVERLAY_HTML);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 373
374 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui) 374 KeyboardOverlayUI::KeyboardOverlayUI(content::WebUI* web_ui)
375 : WebDialogUI(web_ui) { 375 : WebDialogUI(web_ui) {
376 Profile* profile = Profile::FromWebUI(web_ui); 376 Profile* profile = Profile::FromWebUI(web_ui);
377 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); 377 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile);
378 web_ui->AddMessageHandler(handler); 378 web_ui->AddMessageHandler(handler);
379 379
380 // Set up the chrome://keyboardoverlay/ source. 380 // Set up the chrome://keyboardoverlay/ source.
381 content::WebUIDataSource::Add(profile, CreateKeyboardOverlayUIHTMLSource()); 381 content::WebUIDataSource::Add(profile, CreateKeyboardOverlayUIHTMLSource());
382 } 382 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698