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" |
11 #include "grit/ash_strings.h" | 11 #include "grit/ash_strings.h" |
| 12 #include "ui/base/event.h" |
12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
13 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
14 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
15 #include "ui/web_dialogs/web_dialog_delegate.h" | 16 #include "ui/web_dialogs/web_dialog_delegate.h" |
16 | 17 |
17 using ui::WebDialogDelegate; | 18 using ui::WebDialogDelegate; |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 // Keys to invoke Cancel (Escape, Ctrl+Alt+/, or Shift+Ctrl+Alt+/). | 22 // Keys to invoke Cancel (Escape, Ctrl+Alt+/, or Shift+Ctrl+Alt+/). |
(...skipping 18 matching lines...) Expand all Loading... |
40 KeyboardOverlayView::~KeyboardOverlayView() { | 41 KeyboardOverlayView::~KeyboardOverlayView() { |
41 } | 42 } |
42 | 43 |
43 void KeyboardOverlayView::Cancel() { | 44 void KeyboardOverlayView::Cancel() { |
44 ash::Shell::GetInstance()->overlay_filter()->Deactivate(); | 45 ash::Shell::GetInstance()->overlay_filter()->Deactivate(); |
45 views::Widget* widget = GetWidget(); | 46 views::Widget* widget = GetWidget(); |
46 if (widget) | 47 if (widget) |
47 widget->Close(); | 48 widget->Close(); |
48 } | 49 } |
49 | 50 |
50 bool KeyboardOverlayView::IsCancelingKeyEvent(aura::KeyEvent* event) { | 51 bool KeyboardOverlayView::IsCancelingKeyEvent(ui::KeyEvent* event) { |
51 if (event->type() != ui::ET_KEY_PRESSED) | 52 if (event->type() != ui::ET_KEY_PRESSED) |
52 return false; | 53 return false; |
53 for (size_t i = 0; i < arraysize(kCancelKeys); ++i) { | 54 for (size_t i = 0; i < arraysize(kCancelKeys); ++i) { |
54 if ((kCancelKeys[i].key_code == event->key_code()) && | 55 if ((kCancelKeys[i].key_code == event->key_code()) && |
55 (kCancelKeys[i].flags == event->flags())) | 56 (kCancelKeys[i].flags == event->flags())) |
56 return true; | 57 return true; |
57 } | 58 } |
58 return false; | 59 return false; |
59 } | 60 } |
60 | 61 |
(...skipping 10 matching lines...) Expand all Loading... |
71 KeyboardOverlayView* view = | 72 KeyboardOverlayView* view = |
72 new KeyboardOverlayView(context, delegate, handler); | 73 new KeyboardOverlayView(context, delegate, handler); |
73 delegate->Show(view); | 74 delegate->Show(view); |
74 | 75 |
75 ash::Shell::GetInstance()->overlay_filter()->Activate(view); | 76 ash::Shell::GetInstance()->overlay_filter()->Activate(view); |
76 } | 77 } |
77 | 78 |
78 void KeyboardOverlayView::WindowClosing() { | 79 void KeyboardOverlayView::WindowClosing() { |
79 Cancel(); | 80 Cancel(); |
80 } | 81 } |
OLD | NEW |