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

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

Issue 8986007: Move WebUIMessageHandler to its own file in the public directory and put it in the content namesp... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 11 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
12 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 12 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
16 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 16 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
17 #include "chrome/common/jstemplate_builder.h" 17 #include "chrome/common/jstemplate_builder.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "content/public/browser/web_ui_message_handler.h"
22 #include "grit/browser_resources.h" 23 #include "grit/browser_resources.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
26 27
27 using chromeos::input_method::ModifierKey; 28 using chromeos::input_method::ModifierKey;
28 using content::WebContents; 29 using content::WebContents;
30 using content::WebUIMessageHandler;
29 31
30 namespace { 32 namespace {
31 33
32 struct ModifierToLabel { 34 struct ModifierToLabel {
33 const ModifierKey modifier; 35 const ModifierKey modifier;
34 const char* label; 36 const char* label;
35 } kModifierToLabels[] = { 37 } kModifierToLabels[] = {
36 {chromeos::input_method::kSearchKey, "search"}, 38 {chromeos::input_method::kSearchKey, "search"},
37 {chromeos::input_method::kLeftControlKey, "ctrl"}, 39 {chromeos::input_method::kLeftControlKey, "ctrl"},
38 {chromeos::input_method::kLeftAltKey, "alt"}, 40 {chromeos::input_method::kLeftAltKey, "alt"},
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 KeyboardOverlayUI::KeyboardOverlayUI(WebContents* contents) 285 KeyboardOverlayUI::KeyboardOverlayUI(WebContents* contents)
284 : HtmlDialogUI(contents) { 286 : HtmlDialogUI(contents) {
285 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 287 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
286 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); 288 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile);
287 AddMessageHandler(handler); 289 AddMessageHandler(handler);
288 290
289 // Set up the chrome://keyboardoverlay/ source. 291 // Set up the chrome://keyboardoverlay/ source.
290 profile->GetChromeURLDataManager()->AddDataSource( 292 profile->GetChromeURLDataManager()->AddDataSource(
291 CreateKeyboardOverlayUIHTMLSource()); 293 CreateKeyboardOverlayUIHTMLSource());
292 } 294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698