OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_NATIVE_APP_WINDOW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
7 | 7 |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
12 #include "third_party/skia/include/core/SkRegion.h" | 12 #include "third_party/skia/include/core/SkRegion.h" |
13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 #include "ui/views/context_menu_controller.h" | 15 #include "ui/views/context_menu_controller.h" |
16 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 16 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
18 #include "ui/views/widget/widget_delegate.h" | 18 #include "ui/views/widget/widget_delegate.h" |
19 #include "ui/views/widget/widget_observer.h" | 19 #include "ui/views/widget/widget_observer.h" |
20 | 20 |
21 #if defined(OS_WIN) | |
22 #include "chrome/browser/shell_integration.h" | |
23 #endif | |
24 | |
25 #if defined(USE_ASH) | 21 #if defined(USE_ASH) |
26 namespace ash { | 22 namespace ash { |
27 class ImmersiveFullscreenController; | 23 class ImmersiveFullscreenController; |
28 } | 24 } |
29 #endif | 25 #endif |
30 | 26 |
31 class ExtensionKeybindingRegistryViews; | 27 class ExtensionKeybindingRegistryViews; |
32 class Profile; | 28 class Profile; |
33 | 29 |
34 namespace apps { | 30 namespace apps { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 protected: | 65 protected: |
70 // Called before views::Widget::Init() to allow subclasses to customize | 66 // Called before views::Widget::Init() to allow subclasses to customize |
71 // the InitParams that would be passed. | 67 // the InitParams that would be passed. |
72 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params, | 68 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params, |
73 views::Widget* widget); | 69 views::Widget* widget); |
74 | 70 |
75 // ui::BaseWindow implementation that subclasses may override. | 71 // ui::BaseWindow implementation that subclasses may override. |
76 virtual void Show() OVERRIDE; | 72 virtual void Show() OVERRIDE; |
77 virtual void Activate() OVERRIDE; | 73 virtual void Activate() OVERRIDE; |
78 | 74 |
79 Profile* profile() { return shell_window_->profile(); } | 75 Profile* profile() const { return shell_window_->profile(); } |
tapted
2014/02/12 10:16:28
nit: there's usually a guideline that `const` func
| |
80 const extensions::Extension* extension() { | 76 const extensions::Extension* extension() const { |
81 return shell_window_->extension(); | 77 return shell_window_->extension(); |
82 } | 78 } |
79 views::Widget* window() const { return window_; } | |
80 | |
81 virtual void InitializeDefaultWindow( | |
82 const apps::ShellWindow::CreateParams& create_params); | |
83 virtual void InitializePanelWindow( | |
84 const apps::ShellWindow::CreateParams& create_params); | |
83 | 85 |
84 private: | 86 private: |
85 friend class ShapedAppWindowTargeterTest; | 87 friend class ShapedAppWindowTargeterTest; |
86 | 88 |
87 void InitializeDefaultWindow( | |
88 const apps::ShellWindow::CreateParams& create_params); | |
89 void InitializePanelWindow( | |
90 const apps::ShellWindow::CreateParams& create_params); | |
91 void OnViewWasResized(); | 89 void OnViewWasResized(); |
92 | 90 |
93 bool ShouldUseChromeStyleFrame() const; | 91 bool ShouldUseChromeStyleFrame() const; |
94 | 92 |
95 // Caller owns the returned object. | 93 // Caller owns the returned object. |
96 apps::ShellWindowFrameView* CreateShellWindowFrameView(); | 94 apps::ShellWindowFrameView* CreateShellWindowFrameView(); |
97 | 95 |
98 #if defined(OS_WIN) | |
99 void OnShortcutInfoLoaded( | |
100 const ShellIntegration::ShortcutInfo& shortcut_info); | |
101 HWND GetNativeAppWindowHWND() const; | |
102 #endif | |
103 | |
104 // ui::BaseWindow implementation. | 96 // ui::BaseWindow implementation. |
105 virtual bool IsActive() const OVERRIDE; | 97 virtual bool IsActive() const OVERRIDE; |
106 virtual bool IsMaximized() const OVERRIDE; | 98 virtual bool IsMaximized() const OVERRIDE; |
107 virtual bool IsMinimized() const OVERRIDE; | 99 virtual bool IsMinimized() const OVERRIDE; |
108 virtual bool IsFullscreen() const OVERRIDE; | 100 virtual bool IsFullscreen() const OVERRIDE; |
109 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 101 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
110 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | 102 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
111 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; | 103 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; |
112 virtual gfx::Rect GetBounds() const OVERRIDE; | 104 virtual gfx::Rect GetBounds() const OVERRIDE; |
113 virtual void ShowInactive() OVERRIDE; | 105 virtual void ShowInactive() OVERRIDE; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | 176 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
185 virtual SkRegion* GetDraggableRegion() OVERRIDE; | 177 virtual SkRegion* GetDraggableRegion() OVERRIDE; |
186 virtual void UpdateShape(scoped_ptr<SkRegion> region) OVERRIDE; | 178 virtual void UpdateShape(scoped_ptr<SkRegion> region) OVERRIDE; |
187 virtual void HandleKeyboardEvent( | 179 virtual void HandleKeyboardEvent( |
188 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 180 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
189 virtual bool IsFrameless() const OVERRIDE; | 181 virtual bool IsFrameless() const OVERRIDE; |
190 virtual gfx::Insets GetFrameInsets() const OVERRIDE; | 182 virtual gfx::Insets GetFrameInsets() const OVERRIDE; |
191 virtual void HideWithApp() OVERRIDE; | 183 virtual void HideWithApp() OVERRIDE; |
192 virtual void ShowWithApp() OVERRIDE; | 184 virtual void ShowWithApp() OVERRIDE; |
193 virtual void UpdateWindowMinMaxSize() OVERRIDE; | 185 virtual void UpdateWindowMinMaxSize() OVERRIDE; |
186 virtual void UpdateAppMenu() OVERRIDE; | |
194 | 187 |
195 // web_modal::WebContentsModalDialogHost implementation. | 188 // web_modal::WebContentsModalDialogHost implementation. |
196 virtual gfx::NativeView GetHostView() const OVERRIDE; | 189 virtual gfx::NativeView GetHostView() const OVERRIDE; |
197 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; | 190 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; |
198 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; | 191 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; |
199 virtual void AddObserver( | 192 virtual void AddObserver( |
200 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 193 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
201 virtual void RemoveObserver( | 194 virtual void RemoveObserver( |
202 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 195 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
203 | 196 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 232 |
240 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; | 233 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; |
241 | 234 |
242 // Used to show the system menu. | 235 // Used to show the system menu. |
243 scoped_ptr<views::MenuRunner> menu_runner_; | 236 scoped_ptr<views::MenuRunner> menu_runner_; |
244 | 237 |
245 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); | 238 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); |
246 }; | 239 }; |
247 | 240 |
248 #endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ | 241 #endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
OLD | NEW |