Chromium Code Reviews| 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/events/event.h" | 12 #include "ui/base/events/event.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
| 15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 16 #include "ui/web_dialogs/web_dialog_delegate.h" | 16 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 17 | 17 |
| 18 using ui::WebDialogDelegate; | 18 using ui::WebDialogDelegate; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Keys to invoke Cancel (Escape, Ctrl+Alt+/, or Shift+Ctrl+Alt+/). | 22 // Keys to invoke Cancel (Escape, Ctrl+Alt+/, or Shift+Ctrl+Alt+/, Help, F14). |
| 23 const struct KeyEventData { | 23 const ash::KeyboardOverlayView::KeyEventData kCancelKeys[] = { |
| 24 ui::KeyboardCode key_code; | |
| 25 int flags; | |
| 26 } kCancelKeys[] = { | |
| 27 { ui::VKEY_ESCAPE, ui::EF_NONE}, | 24 { ui::VKEY_ESCAPE, ui::EF_NONE}, |
| 28 { ui::VKEY_OEM_2, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN }, | 25 { 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 }, | 26 { ui::VKEY_OEM_2, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN }, |
| 27 { ui::VKEY_HELP, ui::EF_NONE }, | |
| 28 { ui::VKEY_F14, ui::EF_NONE }, | |
| 30 }; | 29 }; |
| 31 | 30 |
| 32 } | 31 } |
| 33 | 32 |
| 34 namespace ash { | 33 namespace ash { |
| 35 | 34 |
| 36 KeyboardOverlayView::KeyboardOverlayView( | 35 KeyboardOverlayView::KeyboardOverlayView( |
| 37 content::BrowserContext* context, | 36 content::BrowserContext* context, |
| 38 WebDialogDelegate* delegate, | 37 WebDialogDelegate* delegate, |
| 39 WebContentsHandler* handler) | 38 WebContentsHandler* handler) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 new KeyboardOverlayView(context, delegate, handler); | 76 new KeyboardOverlayView(context, delegate, handler); |
| 78 delegate->Show(view); | 77 delegate->Show(view); |
| 79 | 78 |
| 80 Shell::GetInstance()->overlay_filter()->Activate(view); | 79 Shell::GetInstance()->overlay_filter()->Activate(view); |
| 81 } | 80 } |
| 82 | 81 |
| 83 void KeyboardOverlayView::WindowClosing() { | 82 void KeyboardOverlayView::WindowClosing() { |
| 84 Cancel(); | 83 Cancel(); |
| 85 } | 84 } |
| 86 | 85 |
| 86 // static | |
| 87 void KeyboardOverlayView::GetCancelingKeysForTesting( | |
| 88 std::vector<KeyboardOverlayView::KeyEventData>* canceling_keys) { | |
| 89 CHECK(canceling_keys); | |
|
Daniel Erat
2012/12/20 04:55:25
nit: canceling_keys->clear() ?
otherwise, documen
mazda
2012/12/20 08:51:11
Added clear(). Thanks.
| |
| 90 for (size_t i = 0; i < arraysize(kCancelKeys); ++i) | |
| 91 canceling_keys->push_back(kCancelKeys[i]); | |
| 92 } | |
| 93 | |
| 87 } // namespace ash | 94 } // namespace ash |
| OLD | NEW |