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

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

Issue 949553002: Start using the controller in app's view. Base URL: https://chromium.googlesource.com/chromium/src.git@fsRefactor
Patch Set: 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
50 private: 62 private:
51 FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest, 63 FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest,
52 ResizeInsetsWithinBounds); 64 ResizeInsetsWithinBounds);
53 65
54 apps::AppWindowFrameView* CreateNonStandardAppFrame(); 66 apps::AppWindowFrameView* CreateNonStandardAppFrame();
55 67
56 // ui::BaseWindow implementation. 68 // ui::BaseWindow implementation.
57 gfx::Rect GetRestoredBounds() const override; 69 gfx::Rect GetRestoredBounds() const override;
58 ui::WindowShowState GetRestoredState() const override; 70 ui::WindowShowState GetRestoredState() const override;
59 bool IsAlwaysOnTop() const override; 71 bool IsAlwaysOnTop() const override;
(...skipping 23 matching lines...) Expand all
83 bool HasFrameColor() const override; 95 bool HasFrameColor() const override;
84 SkColor ActiveFrameColor() const override; 96 SkColor ActiveFrameColor() const override;
85 SkColor InactiveFrameColor() const override; 97 SkColor InactiveFrameColor() const override;
86 void SetInterceptAllKeys(bool want_all_keys) override; 98 void SetInterceptAllKeys(bool want_all_keys) override;
87 99
88 // NativeAppWindowViews implementation. 100 // NativeAppWindowViews implementation.
89 void InitializeWindow( 101 void InitializeWindow(
90 extensions::AppWindow* app_window, 102 extensions::AppWindow* app_window,
91 const extensions::AppWindow::CreateParams& create_params) override; 103 const extensions::AppWindow::CreateParams& create_params) override;
92 104
105 // ExclusiveAccessContext
106 Profile* GetProfile() override;
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;
125
126 // ExclusiveAccessBubbleViewsContext
127 ExclusiveAccessManager* GetExclusiveAccessManager() override;
128 views::Widget* GetWidget() override;
129 bool IsImmersiveModeEnabled() override;
130 gfx::Rect GetTopContainerBoundsInScreen() override;
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_;
102 SkColor inactive_frame_color_; 141 SkColor inactive_frame_color_;
103 gfx::Size preferred_size_; 142 gfx::Size preferred_size_;
104 143
105 // The class that registers for keyboard shortcuts for extension commands. 144 // The class that registers for keyboard shortcuts for extension commands.
106 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; 145 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
107 146
108 #if defined(USE_ASH) 147 #if defined(USE_ASH)
109 // Used to put non-frameless windows into immersive fullscreen on ChromeOS. In 148 // Used to put non-frameless windows into immersive fullscreen on ChromeOS. In
110 // immersive fullscreen, the window header (title bar and window controls) 149 // immersive fullscreen, the window header (title bar and window controls)
111 // slides onscreen as an overlay when the mouse is hovered at the top of the 150 // slides onscreen as an overlay when the mouse is hovered at the top of the
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