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

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

Issue 947343003: Split out Ash/Aura parts of ChromeNativeAppWindowViews. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments 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 "extensions/components/native_app_window/native_app_window_views.h" 9 #include "extensions/components/native_app_window/native_app_window_views.h"
10 #include "ui/views/context_menu_controller.h"
11 10
12 namespace apps { 11 namespace apps {
13 class AppWindowFrameView; 12 class AppWindowFrameView;
14 } 13 }
15 14
16 #if defined(USE_ASH)
17 namespace ash {
18 class ImmersiveFullscreenController;
19 }
20 #endif
21
22 class DesktopKeyboardCapture; 15 class DesktopKeyboardCapture;
23 class ExtensionKeybindingRegistryViews; 16 class ExtensionKeybindingRegistryViews;
24 17
25 namespace views {
26 class MenuRunner;
27 }
28
29 class ChromeNativeAppWindowViews 18 class ChromeNativeAppWindowViews
30 : public native_app_window::NativeAppWindowViews, 19 : public native_app_window::NativeAppWindowViews {
31 public views::ContextMenuController {
32 public: 20 public:
33 ChromeNativeAppWindowViews(); 21 ChromeNativeAppWindowViews();
34 ~ChromeNativeAppWindowViews() override; 22 ~ChromeNativeAppWindowViews() override;
35 23
36 SkRegion* shape() { return shape_.get(); } 24 SkRegion* shape() { return shape_.get(); }
37 25
38 protected: 26 protected:
39 // Called before views::Widget::Init() to allow subclasses to customize 27 // Called before views::Widget::Init() in InitializeDefaultWindow() to allow
40 // the InitParams that would be passed. 28 // subclasses to customize the InitParams that would be passed.
41 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params, 29 virtual void OnBeforeWidgetInit(
42 views::Widget* widget); 30 const extensions::AppWindow::CreateParams& create_params,
31 views::Widget::InitParams* init_params,
32 views::Widget* widget);
33 // Called before views::Widget::Init() in InitializeDefaultWindow() to allow
34 // subclasses to customize the InitParams that would be passed.
35 virtual void OnBeforePanelWidgetInit(views::Widget::InitParams* init_params,
36 views::Widget* widget);
43 37
44 virtual void InitializeDefaultWindow( 38 virtual void InitializeDefaultWindow(
45 const extensions::AppWindow::CreateParams& create_params); 39 const extensions::AppWindow::CreateParams& create_params);
46 virtual void InitializePanelWindow( 40 virtual void InitializePanelWindow(
47 const extensions::AppWindow::CreateParams& create_params); 41 const extensions::AppWindow::CreateParams& create_params);
48 virtual views::NonClientFrameView* CreateStandardDesktopAppFrame(); 42 virtual views::NonClientFrameView* CreateStandardDesktopAppFrame();
43 virtual apps::AppWindowFrameView* CreateNonStandardAppFrame();
49 44
50 // ui::BaseWindow implementation. 45 // ui::BaseWindow implementation.
51 gfx::Rect GetRestoredBounds() const override; 46 gfx::Rect GetRestoredBounds() const override;
52 ui::WindowShowState GetRestoredState() const override; 47 ui::WindowShowState GetRestoredState() const override;
53 bool IsAlwaysOnTop() const override; 48 bool IsAlwaysOnTop() const override;
54 49
55 // Overridden from views::ContextMenuController:
56 void ShowContextMenuForView(views::View* source,
57 const gfx::Point& p,
58 ui::MenuSourceType source_type) override;
59
60 // WidgetDelegate implementation. 50 // WidgetDelegate implementation.
61 gfx::ImageSkia GetWindowAppIcon() override; 51 gfx::ImageSkia GetWindowAppIcon() override;
62 gfx::ImageSkia GetWindowIcon() override; 52 gfx::ImageSkia GetWindowIcon() override;
63 views::NonClientFrameView* CreateNonClientFrameView( 53 views::NonClientFrameView* CreateNonClientFrameView(
64 views::Widget* widget) override; 54 views::Widget* widget) override;
65 bool WidgetHasHitTestMask() const override; 55 bool WidgetHasHitTestMask() const override;
66 void GetWidgetHitTestMask(gfx::Path* mask) const override; 56 void GetWidgetHitTestMask(gfx::Path* mask) const override;
67 57
68 // views::View implementation. 58 // views::View implementation.
69 gfx::Size GetPreferredSize() const override; 59 gfx::Size GetPreferredSize() const override;
70 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 60 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
71 61
72 // NativeAppWindow implementation. 62 // NativeAppWindow implementation.
73 void SetFullscreen(int fullscreen_types) override; 63 void SetFullscreen(int fullscreen_types) override;
74 bool IsFullscreenOrPending() const override; 64 bool IsFullscreenOrPending() const override;
75 void UpdateBadgeIcon() override; 65 void UpdateBadgeIcon() override;
76 void UpdateShape(scoped_ptr<SkRegion> region) override; 66 void UpdateShape(scoped_ptr<SkRegion> region) override;
77 bool HasFrameColor() const override; 67 bool HasFrameColor() const override;
78 SkColor ActiveFrameColor() const override; 68 SkColor ActiveFrameColor() const override;
79 SkColor InactiveFrameColor() const override; 69 SkColor InactiveFrameColor() const override;
80 void SetInterceptAllKeys(bool want_all_keys) override; 70 void SetInterceptAllKeys(bool want_all_keys) override;
81 71
82 // NativeAppWindowViews implementation. 72 // NativeAppWindowViews implementation.
83 void InitializeWindow( 73 void InitializeWindow(
84 extensions::AppWindow* app_window, 74 extensions::AppWindow* app_window,
85 const extensions::AppWindow::CreateParams& create_params) override; 75 const extensions::AppWindow::CreateParams& create_params) override;
86 76
87 private: 77 private:
88 FRIEND_TEST_ALL_PREFIXES(ShapedAppWindowTargeterTest,
89 ResizeInsetsWithinBounds);
90
91 apps::AppWindowFrameView* CreateNonStandardAppFrame();
92
93 // True if the window is fullscreen or fullscreen is pending. 78 // True if the window is fullscreen or fullscreen is pending.
94 bool is_fullscreen_; 79 bool is_fullscreen_;
95 80
96 // Custom shape of the window. If this is not set then the window has a 81 // Custom shape of the window. If this is not set then the window has a
97 // default shape, usually rectangular. 82 // default shape, usually rectangular.
98 scoped_ptr<SkRegion> shape_; 83 scoped_ptr<SkRegion> shape_;
99 84
100 bool has_frame_color_; 85 bool has_frame_color_;
101 SkColor active_frame_color_; 86 SkColor active_frame_color_;
102 SkColor inactive_frame_color_; 87 SkColor inactive_frame_color_;
103 gfx::Size preferred_size_; 88 gfx::Size preferred_size_;
104 89
105 // The class that registers for keyboard shortcuts for extension commands. 90 // The class that registers for keyboard shortcuts for extension commands.
106 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; 91 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
107 92
108 #if defined(USE_ASH)
109 // Used to put non-frameless windows into immersive fullscreen on ChromeOS. In
110 // 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
112 // screen.
113 scoped_ptr<ash::ImmersiveFullscreenController>
114 immersive_fullscreen_controller_;
115 #endif // defined(USE_ASH)
116
117 // Used to show the system menu.
118 scoped_ptr<views::MenuRunner> menu_runner_;
119
120 // Used to capture all keyboard events including task switching sequence. 93 // Used to capture all keyboard events including task switching sequence.
121 scoped_ptr<DesktopKeyboardCapture> desktop_keyboard_capture_; 94 scoped_ptr<DesktopKeyboardCapture> desktop_keyboard_capture_;
122 95
123 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews); 96 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews);
124 }; 97 };
125 98
126 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_ 99 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698