| 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 #ifndef ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ | 5 #ifndef ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ |
| 6 #define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ | 6 #define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> |
| 9 |
| 8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 9 #include "ash/wm/overlay_event_filter.h" | 11 #include "ash/wm/overlay_event_filter.h" |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" |
| 11 #include "ui/views/controls/webview/web_dialog_view.h" | 14 #include "ui/views/controls/webview/web_dialog_view.h" |
| 12 | 15 |
| 13 class GURL; | 16 class GURL; |
| 14 | 17 |
| 15 namespace content { | 18 namespace content { |
| 16 class BrowserContext; | 19 class BrowserContext; |
| 17 } | 20 } |
| 18 | 21 |
| 19 namespace ui { | 22 namespace ui { |
| 20 class WebDialogDelegate; | 23 class WebDialogDelegate; |
| 21 } | 24 } |
| 22 | 25 |
| 23 namespace ash { | 26 namespace ash { |
| 24 | 27 |
| 25 // A customized dialog view for the keyboard overlay. | 28 // A customized dialog view for the keyboard overlay. |
| 26 class ASH_EXPORT KeyboardOverlayView | 29 class ASH_EXPORT KeyboardOverlayView |
| 27 : public views::WebDialogView, | 30 : public views::WebDialogView, |
| 28 public ash::internal::OverlayEventFilter::Delegate { | 31 public ash::internal::OverlayEventFilter::Delegate { |
| 29 public: | 32 public: |
| 33 struct KeyEventData { |
| 34 ui::KeyboardCode key_code; |
| 35 int flags; |
| 36 }; |
| 37 |
| 30 KeyboardOverlayView(content::BrowserContext* context, | 38 KeyboardOverlayView(content::BrowserContext* context, |
| 31 ui::WebDialogDelegate* delegate, | 39 ui::WebDialogDelegate* delegate, |
| 32 WebContentsHandler* handler); | 40 WebContentsHandler* handler); |
| 33 virtual ~KeyboardOverlayView(); | 41 virtual ~KeyboardOverlayView(); |
| 34 | 42 |
| 35 // Overridden from ash::internal::OverlayEventFilter::Delegate: | 43 // Overridden from ash::internal::OverlayEventFilter::Delegate: |
| 36 virtual void Cancel() OVERRIDE; | 44 virtual void Cancel() OVERRIDE; |
| 37 virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) OVERRIDE; | 45 virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) OVERRIDE; |
| 38 virtual aura::Window* GetWindow() OVERRIDE; | 46 virtual aura::Window* GetWindow() OVERRIDE; |
| 39 | 47 |
| 40 // Shows the keyboard overlay. | 48 // Shows the keyboard overlay. |
| 41 static void ShowDialog(content::BrowserContext* context, | 49 static void ShowDialog(content::BrowserContext* context, |
| 42 WebContentsHandler* handler, | 50 WebContentsHandler* handler, |
| 43 const GURL& url); | 51 const GURL& url); |
| 44 | 52 |
| 45 private: | 53 private: |
| 54 FRIEND_TEST_ALL_PREFIXES(KeyboardOverlayViewTest, OpenAcceleratorsClose); |
| 55 FRIEND_TEST_ALL_PREFIXES(KeyboardOverlayViewTest, NoRedundantCancelingKeys); |
| 56 |
| 46 // Overridden from views::WidgetDelegate: | 57 // Overridden from views::WidgetDelegate: |
| 47 virtual void WindowClosing() OVERRIDE; | 58 virtual void WindowClosing() OVERRIDE; |
| 48 | 59 |
| 60 static void GetCancelingKeysForTesting( |
| 61 std::vector<KeyEventData>* canceling_keys); |
| 62 |
| 49 DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayView); | 63 DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayView); |
| 50 }; | 64 }; |
| 51 | 65 |
| 52 } // namespace ash | 66 } // namespace ash |
| 53 | 67 |
| 54 #endif // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ | 68 #endif // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_ |
| OLD | NEW |