Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.h

Issue 944123003: Hack webapp to request keyboard events on connection. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hacked up chromoting client and using mouse lock instead of keyboard lock for bubble. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
10 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h"
9 #include "extensions/components/native_app_window/native_app_window_views.h" 11 #include "extensions/components/native_app_window/native_app_window_views.h"
10 #include "ui/views/context_menu_controller.h" 12 #include "ui/views/context_menu_controller.h"
11 13
12 namespace apps { 14 namespace apps {
13 class AppWindowFrameView; 15 class AppWindowFrameView;
14 } 16 }
15 17
16 #if defined(USE_ASH) 18 #if defined(USE_ASH)
17 namespace ash { 19 namespace ash {
18 class ImmersiveFullscreenController; 20 class ImmersiveFullscreenController;
19 } 21 }
20 #endif 22 #endif
21 23
22 class DesktopKeyboardCapture; 24 class DesktopKeyboardCapture;
25 class ExclusiveAccessManager;
26 class ExclusiveAccessBubbleViews;
23 class ExtensionKeybindingRegistryViews; 27 class ExtensionKeybindingRegistryViews;
24 28
25 namespace views { 29 namespace views {
26 class MenuRunner; 30 class MenuRunner;
27 } 31 }
28 32
29 class ChromeNativeAppWindowViews 33 class ChromeNativeAppWindowViews
30 : public native_app_window::NativeAppWindowViews, 34 : public native_app_window::NativeAppWindowViews,
31 public views::ContextMenuController { 35 public views::ContextMenuController,
36 public ExclusiveAccessContext,
37 public ExclusiveAccessBubbleViewsContext {
32 public: 38 public:
33 ChromeNativeAppWindowViews(); 39 ChromeNativeAppWindowViews();
34 ~ChromeNativeAppWindowViews() override; 40 ~ChromeNativeAppWindowViews() override;
35 41
36 SkRegion* shape() { return shape_.get(); } 42 SkRegion* shape() { return shape_.get(); }
37 43
38 protected: 44 protected:
39 // Called before views::Widget::Init() to allow subclasses to customize 45 // Called before views::Widget::Init() to allow subclasses to customize
40 // the InitParams that would be passed. 46 // the InitParams that would be passed.
41 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params, 47 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params,
42 views::Widget* widget); 48 views::Widget* widget);
43 49
44 virtual void InitializeDefaultWindow( 50 virtual void InitializeDefaultWindow(
45 const extensions::AppWindow::CreateParams& create_params); 51 const extensions::AppWindow::CreateParams& create_params);
46 virtual void InitializePanelWindow( 52 virtual void InitializePanelWindow(
47 const extensions::AppWindow::CreateParams& create_params); 53 const extensions::AppWindow::CreateParams& create_params);
48 virtual views::NonClientFrameView* CreateStandardDesktopAppFrame(); 54 virtual views::NonClientFrameView* CreateStandardDesktopAppFrame();
49 55
56 void Activate() override;
57 void Deactivate() override;
58 bool PreHandleKeyboardEvent(content::WebContents* source,
59 const content::NativeWebKeyboardEvent& event,
60 bool* is_keyboard_shortcut) override;
61
62 protected:
63 FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest,
64 ResizeInsetsWithinBounds);
65
66 apps::AppWindowFrameView* CreateNonStandardAppFrame();
67
50 // ui::BaseWindow implementation. 68 // ui::BaseWindow implementation.
51 gfx::Rect GetRestoredBounds() const override; 69 gfx::Rect GetRestoredBounds() const override;
52 ui::WindowShowState GetRestoredState() const override; 70 ui::WindowShowState GetRestoredState() const override;
53 bool IsAlwaysOnTop() const override; 71 bool IsAlwaysOnTop() const override;
54 72
55 // Overridden from views::ContextMenuController: 73 // Overridden from views::ContextMenuController:
56 void ShowContextMenuForView(views::View* source, 74 void ShowContextMenuForView(views::View* source,
57 const gfx::Point& p, 75 const gfx::Point& p,
58 ui::MenuSourceType source_type) override; 76 ui::MenuSourceType source_type) override;
59 77
(...skipping 17 matching lines...) Expand all
77 bool HasFrameColor() const override; 95 bool HasFrameColor() const override;
78 SkColor ActiveFrameColor() const override; 96 SkColor ActiveFrameColor() const override;
79 SkColor InactiveFrameColor() const override; 97 SkColor InactiveFrameColor() const override;
80 void SetInterceptAllKeys(bool want_all_keys) override; 98 void SetInterceptAllKeys(bool want_all_keys) override;
81 99
82 // NativeAppWindowViews implementation. 100 // NativeAppWindowViews implementation.
83 void InitializeWindow( 101 void InitializeWindow(
84 extensions::AppWindow* app_window, 102 extensions::AppWindow* app_window,
85 const extensions::AppWindow::CreateParams& create_params) override; 103 const extensions::AppWindow::CreateParams& create_params) override;
86 104
87 private: 105 // ExclusiveAccessContext
88 FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest, 106 Profile* GetProfile() override;
89 ResizeInsetsWithinBounds); 107 bool IsFullscreen() const override;
108 bool IsFullscreenWithToolbar() override;
109 bool SupportsFullscreenWithToolbar() override;
110 void EnterFullscreen(const GURL& url,
111 ExclusiveAccessBubbleType bubble_type,
112 bool with_toolbar) override;
113 void ExitFullscreen() override;
114 void UpdateExclusiveAccessExitBubbleContent(
115 GURL url,
116 ExclusiveAccessBubbleType bubble_type) override;
117 content::WebContents* GetActiveWebContents() override;
118 void UpdateFullscreenWithToolbar(bool with_toolbar) override;
119 void SetMetroSnapMode(bool enable) override;
120 bool IsInMetroSnapMode() override;
121 void UpdateDownloadShelf(bool unhide) override;
122 // HACK:
123 bool UseCallbackForMouseLock() override;
124 bool MouseLockCallback(bool acquired) override;
90 125
91 apps::AppWindowFrameView* CreateNonStandardAppFrame(); 126 // ExclusiveAccessBubbleViewsContext
127 ExclusiveAccessManager* GetExclusiveAccessManager() override;
128 views::Widget* GetWidget() override;
129 bool IsImmersiveModeEnabled() override;
130 gfx::Rect GetTopContainerBoundsInScreen() override;
92 131
93 // True if the window is fullscreen or fullscreen is pending. 132 // True if the window is fullscreen or fullscreen is pending.
94 bool is_fullscreen_; 133 bool is_fullscreen_;
95 134
96 // Custom shape of the window. If this is not set then the window has a 135 // Custom shape of the window. If this is not set then the window has a
97 // default shape, usually rectangular. 136 // default shape, usually rectangular.
98 scoped_ptr<SkRegion> shape_; 137 scoped_ptr<SkRegion> shape_;
99 138
100 bool has_frame_color_; 139 bool has_frame_color_;
101 SkColor active_frame_color_; 140 SkColor active_frame_color_;
(...skipping 10 matching lines...) Expand all
112 // screen. 151 // screen.
113 scoped_ptr<ash::ImmersiveFullscreenController> 152 scoped_ptr<ash::ImmersiveFullscreenController>
114 immersive_fullscreen_controller_; 153 immersive_fullscreen_controller_;
115 #endif // defined(USE_ASH) 154 #endif // defined(USE_ASH)
116 155
117 // Used to show the system menu. 156 // Used to show the system menu.
118 scoped_ptr<views::MenuRunner> menu_runner_; 157 scoped_ptr<views::MenuRunner> menu_runner_;
119 158
120 // Used to capture all keyboard events including task switching sequence. 159 // Used to capture all keyboard events including task switching sequence.
121 scoped_ptr<DesktopKeyboardCapture> desktop_keyboard_capture_; 160 scoped_ptr<DesktopKeyboardCapture> desktop_keyboard_capture_;
161 bool key_capture_requested_;
162
163 // USed to show and control exclusive access bubble.
164 scoped_ptr<ExclusiveAccessManager> exclusive_access_manager_;
165 scoped_ptr<ExclusiveAccessBubbleViews> exclusive_access_bubble_views_;
122 166
123 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews); 167 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews);
124 }; 168 };
125 169
126 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_ 170 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698