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/views/keyboard_overlay_dialog_view.h" | 5 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/chromeos/frame/bubble_window.h" | |
9 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
10 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
11 #include "chrome/browser/ui/views/accelerator_table.h" | 10 #include "chrome/browser/ui/views/accelerator_table.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h" | 12 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h" |
14 #include "chrome/browser/ui/views/window.h" | |
15 #include "content/browser/tab_contents/tab_contents.h" | 13 #include "content/browser/tab_contents/tab_contents.h" |
16 #include "content/public/browser/native_web_keyboard_event.h" | 14 #include "content/public/browser/native_web_keyboard_event.h" |
17 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
18 #include "ui/base/keycodes/keyboard_codes.h" | 16 #include "ui/base/keycodes/keyboard_codes.h" |
19 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/views/events/event.h" | 18 #include "ui/views/events/event.h" |
21 #include "ui/views/widget/root_view.h" | |
22 #include "ui/views/widget/widget.h" | |
23 | 19 |
24 namespace { | 20 namespace { |
25 struct Accelerator { | 21 struct Accelerator { |
26 ui::KeyboardCode keycode; | 22 ui::KeyboardCode keycode; |
27 bool shift_pressed; | 23 bool shift_pressed; |
28 bool ctrl_pressed; | 24 bool ctrl_pressed; |
29 bool alt_pressed; | 25 bool alt_pressed; |
30 } kCloseAccelerators[] = { | 26 } kCloseAccelerators[] = { |
31 {ui::VKEY_OEM_2, false, true, true}, | 27 {ui::VKEY_OEM_2, false, true, true}, |
32 {ui::VKEY_OEM_2, true, true, true}, | 28 {ui::VKEY_OEM_2, true, true, true}, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Temporarily disable Shift+Alt. crosbug.com/17208. | 82 // Temporarily disable Shift+Alt. crosbug.com/17208. |
87 chromeos::input_method::InputMethodManager::GetInstance()->RemoveHotkeys(); | 83 chromeos::input_method::InputMethodManager::GetInstance()->RemoveHotkeys(); |
88 | 84 |
89 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( | 85 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( |
90 UTF16ToWide(l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE))); | 86 UTF16ToWide(l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE))); |
91 KeyboardOverlayDialogView* html_view = | 87 KeyboardOverlayDialogView* html_view = |
92 new KeyboardOverlayDialogView(parent_view->browser()->profile(), | 88 new KeyboardOverlayDialogView(parent_view->browser()->profile(), |
93 delegate, | 89 delegate, |
94 parent_view); | 90 parent_view); |
95 delegate->set_view(html_view); | 91 delegate->set_view(html_view); |
96 html_view->InitDialog(); | 92 browser::ShowHtmlDialog(owning_window, parent_view->browser()->profile(), |
97 chromeos::BubbleWindow::Create(owning_window, | 93 html_view, STYLE_FLUSH); |
98 STYLE_FLUSH, | |
99 html_view); | |
100 html_view->GetWidget()->Show(); | |
101 } | 94 } |
102 | 95 |
103 bool KeyboardOverlayDialogView::IsCloseAccelerator( | 96 bool KeyboardOverlayDialogView::IsCloseAccelerator( |
104 const ui::Accelerator& accelerator) { | 97 const ui::Accelerator& accelerator) { |
105 return close_accelerators_.find(accelerator) != close_accelerators_.end(); | 98 return close_accelerators_.find(accelerator) != close_accelerators_.end(); |
106 } | 99 } |
OLD | NEW |