OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_ |
6 #define EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "components/web_modal/web_contents_modal_dialog_host.h" | 11 #include "components/web_modal/web_contents_modal_dialog_host.h" |
12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
13 #include "ui/base/base_window.h" | 13 #include "ui/base/base_window.h" |
14 #include "ui/gfx/geometry/insets.h" | 14 #include "ui/gfx/geometry/insets.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 struct NativeWebKeyboardEvent; | 17 struct NativeWebKeyboardEvent; |
| 18 class WebContents; |
18 } | 19 } |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 | 22 |
22 struct DraggableRegion; | 23 struct DraggableRegion; |
23 | 24 |
24 // This is an interface to a native implementation of a app window, used for | 25 // This is an interface to a native implementation of a app window, used for |
25 // new-style packaged apps. App windows contain a web contents, but no tabs | 26 // new-style packaged apps. App windows contain a web contents, but no tabs |
26 // or URL bar. | 27 // or URL bar. |
27 class NativeAppWindow : public ui::BaseWindow, | 28 class NativeAppWindow : public ui::BaseWindow, |
(...skipping 23 matching lines...) Expand all Loading... |
51 virtual SkRegion* GetDraggableRegion() = 0; | 52 virtual SkRegion* GetDraggableRegion() = 0; |
52 | 53 |
53 // Called when the window shape is changed. If |region| is NULL then the | 54 // Called when the window shape is changed. If |region| is NULL then the |
54 // window is restored to the default shape. | 55 // window is restored to the default shape. |
55 virtual void UpdateShape(scoped_ptr<SkRegion> region) = 0; | 56 virtual void UpdateShape(scoped_ptr<SkRegion> region) = 0; |
56 | 57 |
57 // Set whether the window should receive all keyboard events including task | 58 // Set whether the window should receive all keyboard events including task |
58 // switching keys. | 59 // switching keys. |
59 virtual void SetInterceptAllKeys(bool want_all_keys) = 0; | 60 virtual void SetInterceptAllKeys(bool want_all_keys) = 0; |
60 | 61 |
| 62 // Handle key before content receives it. |
| 63 virtual bool PreHandleKeyboardEvent( |
| 64 content::WebContents* source, |
| 65 const content::NativeWebKeyboardEvent& event, |
| 66 bool* is_keyboard_shortcut) = 0; |
| 67 |
61 // Allows the window to handle unhandled keyboard messages coming back from | 68 // Allows the window to handle unhandled keyboard messages coming back from |
62 // the renderer. | 69 // the renderer. |
63 virtual void HandleKeyboardEvent( | 70 virtual void HandleKeyboardEvent( |
64 const content::NativeWebKeyboardEvent& event) = 0; | 71 const content::NativeWebKeyboardEvent& event) = 0; |
65 | 72 |
66 // Returns true if the window has no frame, as for a window opened by | 73 // Returns true if the window has no frame, as for a window opened by |
67 // chrome.app.window.create with the option 'frame' set to 'none'. | 74 // chrome.app.window.create with the option 'frame' set to 'none'. |
68 virtual bool IsFrameless() const = 0; | 75 virtual bool IsFrameless() const = 0; |
69 | 76 |
70 // Returns information about the window's frame. | 77 // Returns information about the window's frame. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Returns false if the underlying native window ignores alpha transparency | 109 // Returns false if the underlying native window ignores alpha transparency |
103 // when compositing. | 110 // when compositing. |
104 virtual bool CanHaveAlphaEnabled() const = 0; | 111 virtual bool CanHaveAlphaEnabled() const = 0; |
105 | 112 |
106 ~NativeAppWindow() override {} | 113 ~NativeAppWindow() override {} |
107 }; | 114 }; |
108 | 115 |
109 } // namespace extensions | 116 } // namespace extensions |
110 | 117 |
111 #endif // EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_ | 118 #endif // EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_ |
OLD | NEW |