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 "ash/keyboard_overlay/keyboard_overlay_view.h" | 5 #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
6 | 6 |
7 #include "ash/keyboard_overlay/keyboard_overlay_delegate.h" | 7 #include "ash/keyboard_overlay/keyboard_overlay_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 ui::KeyboardCode key_code; | 24 ui::KeyboardCode key_code; |
25 int flags; | 25 int flags; |
26 } kCancelKeys[] = { | 26 } kCancelKeys[] = { |
27 { ui::VKEY_ESCAPE, ui::EF_NONE}, | 27 { ui::VKEY_ESCAPE, ui::EF_NONE}, |
28 { ui::VKEY_OEM_2, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN }, | 28 { ui::VKEY_OEM_2, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN }, |
29 { ui::VKEY_OEM_2, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN }, | 29 { ui::VKEY_OEM_2, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN }, |
30 }; | 30 }; |
31 | 31 |
32 } | 32 } |
33 | 33 |
| 34 namespace ash { |
| 35 |
34 KeyboardOverlayView::KeyboardOverlayView( | 36 KeyboardOverlayView::KeyboardOverlayView( |
35 content::BrowserContext* context, | 37 content::BrowserContext* context, |
36 WebDialogDelegate* delegate, | 38 WebDialogDelegate* delegate, |
37 WebContentsHandler* handler) | 39 WebContentsHandler* handler) |
38 : views::WebDialogView(context, delegate, handler) { | 40 : views::WebDialogView(context, delegate, handler) { |
39 } | 41 } |
40 | 42 |
41 KeyboardOverlayView::~KeyboardOverlayView() { | 43 KeyboardOverlayView::~KeyboardOverlayView() { |
42 } | 44 } |
43 | 45 |
44 void KeyboardOverlayView::Cancel() { | 46 void KeyboardOverlayView::Cancel() { |
45 ash::Shell::GetInstance()->overlay_filter()->Deactivate(); | 47 Shell::GetInstance()->overlay_filter()->Deactivate(); |
46 views::Widget* widget = GetWidget(); | 48 views::Widget* widget = GetWidget(); |
47 if (widget) | 49 if (widget) |
48 widget->Close(); | 50 widget->Close(); |
49 } | 51 } |
50 | 52 |
51 bool KeyboardOverlayView::IsCancelingKeyEvent(ui::KeyEvent* event) { | 53 bool KeyboardOverlayView::IsCancelingKeyEvent(ui::KeyEvent* event) { |
52 if (event->type() != ui::ET_KEY_PRESSED) | 54 if (event->type() != ui::ET_KEY_PRESSED) |
53 return false; | 55 return false; |
54 // Ignore the caps lock state. | 56 // Ignore the caps lock state. |
55 const int flags = (event->flags() & ~ui::EF_CAPS_LOCK_DOWN); | 57 const int flags = (event->flags() & ~ui::EF_CAPS_LOCK_DOWN); |
(...skipping 12 matching lines...) Expand all Loading... |
68 void KeyboardOverlayView::ShowDialog( | 70 void KeyboardOverlayView::ShowDialog( |
69 content::BrowserContext* context, | 71 content::BrowserContext* context, |
70 WebContentsHandler* handler, | 72 WebContentsHandler* handler, |
71 const GURL& url) { | 73 const GURL& url) { |
72 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( | 74 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( |
73 l10n_util::GetStringUTF16(IDS_ASH_KEYBOARD_OVERLAY_TITLE), url); | 75 l10n_util::GetStringUTF16(IDS_ASH_KEYBOARD_OVERLAY_TITLE), url); |
74 KeyboardOverlayView* view = | 76 KeyboardOverlayView* view = |
75 new KeyboardOverlayView(context, delegate, handler); | 77 new KeyboardOverlayView(context, delegate, handler); |
76 delegate->Show(view); | 78 delegate->Show(view); |
77 | 79 |
78 ash::Shell::GetInstance()->overlay_filter()->Activate(view); | 80 Shell::GetInstance()->overlay_filter()->Activate(view); |
79 } | 81 } |
80 | 82 |
81 void KeyboardOverlayView::WindowClosing() { | 83 void KeyboardOverlayView::WindowClosing() { |
82 Cancel(); | 84 Cancel(); |
83 } | 85 } |
| 86 |
| 87 } // namespace ash |
OLD | NEW |