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

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

Issue 616253002: Extract NativeAppWindow from src/extensions Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: might fix athena. similarity=33 Created 6 years, 2 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 "components/native_app_window/native_app_window_views.h" 9 #include "components/native_app_window/native_app_window_views.h"
10 #include "ui/views/context_menu_controller.h" 10 #include "ui/views/context_menu_controller.h"
11 11
12 namespace apps { 12 namespace apps {
13 class AppWindowFrameView; 13 class AppWindowFrameView;
14 } 14 }
15 15
16 #if defined(USE_ASH) 16 #if defined(USE_ASH)
17 namespace ash { 17 namespace ash {
18 class ImmersiveFullscreenController; 18 class ImmersiveFullscreenController;
19 } 19 }
20 #endif 20 #endif
21 21
22 class ExtensionKeybindingRegistryViews; 22 namespace extensions {
23 class AppWindow;
24 }
23 25
24 namespace views { 26 namespace views {
25 class MenuRunner; 27 class MenuRunner;
26 } 28 }
27 29
30 class ExtensionKeybindingRegistryViews;
31
28 class ChromeNativeAppWindowViews 32 class ChromeNativeAppWindowViews
29 : public native_app_window::NativeAppWindowViews, 33 : public native_app_window::NativeAppWindowViews,
30 public views::ContextMenuController { 34 public views::ContextMenuController {
31 public: 35 public:
32 ChromeNativeAppWindowViews(); 36 explicit ChromeNativeAppWindowViews(
37 extensions::AppWindow* extensions_app_window);
33 virtual ~ChromeNativeAppWindowViews(); 38 virtual ~ChromeNativeAppWindowViews();
34 39
35 SkRegion* shape() { return shape_.get(); } 40 SkRegion* shape() { return shape_.get(); }
36 41
37 protected: 42 protected:
38 // Called before views::Widget::Init() to allow subclasses to customize 43 // Called before views::Widget::Init() to allow subclasses to customize
39 // the InitParams that would be passed. 44 // the InitParams that would be passed.
40 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params, 45 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params,
41 views::Widget* widget); 46 views::Widget* widget);
42 47
43 virtual void InitializeDefaultWindow( 48 virtual void InitializeDefaultWindow(
44 const extensions::AppWindow::CreateParams& create_params); 49 const native_app_window::AppWindowCreateParams& create_params);
45 virtual void InitializePanelWindow( 50 virtual void InitializePanelWindow(
46 const extensions::AppWindow::CreateParams& create_params); 51 const native_app_window::AppWindowCreateParams& create_params);
47 virtual views::NonClientFrameView* CreateStandardDesktopAppFrame(); 52 virtual views::NonClientFrameView* CreateStandardDesktopAppFrame();
48 53
54 extensions::AppWindow* extensions_app_window() {
55 return extensions_app_window_;
56 }
57
49 private: 58 private:
50 FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest, 59 FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest,
51 ResizeInsetsWithinBounds); 60 ResizeInsetsWithinBounds);
52 61
53 apps::AppWindowFrameView* CreateNonStandardAppFrame(); 62 apps::AppWindowFrameView* CreateNonStandardAppFrame();
54 63
55 // ui::BaseWindow implementation. 64 // ui::BaseWindow implementation.
56 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 65 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
57 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; 66 virtual ui::WindowShowState GetRestoredState() const OVERRIDE;
58 virtual bool IsAlwaysOnTop() const OVERRIDE; 67 virtual bool IsAlwaysOnTop() const OVERRIDE;
(...skipping 19 matching lines...) Expand all
78 virtual void SetFullscreen(int fullscreen_types) OVERRIDE; 87 virtual void SetFullscreen(int fullscreen_types) OVERRIDE;
79 virtual bool IsFullscreenOrPending() const OVERRIDE; 88 virtual bool IsFullscreenOrPending() const OVERRIDE;
80 virtual void UpdateBadgeIcon() OVERRIDE; 89 virtual void UpdateBadgeIcon() OVERRIDE;
81 virtual void UpdateShape(scoped_ptr<SkRegion> region) OVERRIDE; 90 virtual void UpdateShape(scoped_ptr<SkRegion> region) OVERRIDE;
82 virtual bool HasFrameColor() const OVERRIDE; 91 virtual bool HasFrameColor() const OVERRIDE;
83 virtual SkColor ActiveFrameColor() const OVERRIDE; 92 virtual SkColor ActiveFrameColor() const OVERRIDE;
84 virtual SkColor InactiveFrameColor() const OVERRIDE; 93 virtual SkColor InactiveFrameColor() const OVERRIDE;
85 94
86 // NativeAppWindowViews implementation. 95 // NativeAppWindowViews implementation.
87 virtual void InitializeWindow( 96 virtual void InitializeWindow(
88 extensions::AppWindow* app_window, 97 native_app_window::NativeAppWindowDelegate* app_window,
89 const extensions::AppWindow::CreateParams& create_params) OVERRIDE; 98 const native_app_window::AppWindowCreateParams& create_params) OVERRIDE;
90 99
91 // True if the window is fullscreen or fullscreen is pending. 100 // True if the window is fullscreen or fullscreen is pending.
92 bool is_fullscreen_; 101 bool is_fullscreen_;
93 102
94 // Custom shape of the window. If this is not set then the window has a 103 // Custom shape of the window. If this is not set then the window has a
95 // default shape, usually rectangular. 104 // default shape, usually rectangular.
96 scoped_ptr<SkRegion> shape_; 105 scoped_ptr<SkRegion> shape_;
97 106
98 bool has_frame_color_; 107 bool has_frame_color_;
99 SkColor active_frame_color_; 108 SkColor active_frame_color_;
100 SkColor inactive_frame_color_; 109 SkColor inactive_frame_color_;
101 gfx::Size preferred_size_; 110 gfx::Size preferred_size_;
102 111
103 // The class that registers for keyboard shortcuts for extension commands. 112 // The class that registers for keyboard shortcuts for extension commands.
104 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; 113 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
105 114
106 #if defined(USE_ASH) 115 #if defined(USE_ASH)
107 // Used to put non-frameless windows into immersive fullscreen on ChromeOS. In 116 // Used to put non-frameless windows into immersive fullscreen on ChromeOS. In
108 // immersive fullscreen, the window header (title bar and window controls) 117 // immersive fullscreen, the window header (title bar and window controls)
109 // slides onscreen as an overlay when the mouse is hovered at the top of the 118 // slides onscreen as an overlay when the mouse is hovered at the top of the
110 // screen. 119 // screen.
111 scoped_ptr<ash::ImmersiveFullscreenController> 120 scoped_ptr<ash::ImmersiveFullscreenController>
112 immersive_fullscreen_controller_; 121 immersive_fullscreen_controller_;
113 #endif // defined(USE_ASH) 122 #endif // defined(USE_ASH)
114 123
115 // Used to show the system menu. 124 // Used to show the system menu.
116 scoped_ptr<views::MenuRunner> menu_runner_; 125 scoped_ptr<views::MenuRunner> menu_runner_;
117 126
127 // Strongly typed delegate.
128 extensions::AppWindow* extensions_app_window_;
129
118 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews); 130 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews);
119 }; 131 };
120 132
121 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_ 133 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698