| OLD | NEW |
| 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/browser/tab_contents/tab_contents.h" | |
| 21 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/web_contents.h" |
| 22 #include "grit/browser_resources.h" | 22 #include "grit/browser_resources.h" |
| 23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 26 | 26 |
| 27 using chromeos::input_method::ModifierKey; | 27 using chromeos::input_method::ModifierKey; |
| 28 using content::WebContents; |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 struct ModifierToLabel { | 32 struct ModifierToLabel { |
| 32 const ModifierKey modifier; | 33 const ModifierKey modifier; |
| 33 const char* label; | 34 const char* label; |
| 34 } kModifierToLabels[] = { | 35 } kModifierToLabels[] = { |
| 35 {chromeos::input_method::kSearchKey, "search"}, | 36 {chromeos::input_method::kSearchKey, "search"}, |
| 36 {chromeos::input_method::kLeftControlKey, "ctrl"}, | 37 {chromeos::input_method::kLeftControlKey, "ctrl"}, |
| 37 {chromeos::input_method::kLeftAltKey, "alt"}, | 38 {chromeos::input_method::kLeftAltKey, "alt"}, |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 273 |
| 273 web_ui()->CallJavascriptFunction("initIdentifierMap", dict); | 274 web_ui()->CallJavascriptFunction("initIdentifierMap", dict); |
| 274 } | 275 } |
| 275 | 276 |
| 276 //////////////////////////////////////////////////////////////////////////////// | 277 //////////////////////////////////////////////////////////////////////////////// |
| 277 // | 278 // |
| 278 // KeyboardOverlayUI | 279 // KeyboardOverlayUI |
| 279 // | 280 // |
| 280 //////////////////////////////////////////////////////////////////////////////// | 281 //////////////////////////////////////////////////////////////////////////////// |
| 281 | 282 |
| 282 KeyboardOverlayUI::KeyboardOverlayUI(TabContents* contents) | 283 KeyboardOverlayUI::KeyboardOverlayUI(WebContents* contents) |
| 283 : HtmlDialogUI(contents) { | 284 : HtmlDialogUI(contents) { |
| 284 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 285 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 285 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); | 286 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(profile); |
| 286 AddMessageHandler(handler); | 287 AddMessageHandler(handler); |
| 287 | 288 |
| 288 // Set up the chrome://keyboardoverlay/ source. | 289 // Set up the chrome://keyboardoverlay/ source. |
| 289 profile->GetChromeURLDataManager()->AddDataSource( | 290 profile->GetChromeURLDataManager()->AddDataSource( |
| 290 CreateKeyboardOverlayUIHTMLSource()); | 291 CreateKeyboardOverlayUIHTMLSource()); |
| 291 } | 292 } |
| OLD | NEW |