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

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

Issue 166573005: Rename apps::ShellWindow to apps::AppWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, nits (rename) Created 6 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 | Annotate | Revision Log
OLDNEW
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/app_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) 21 #if defined(OS_WIN)
22 #include "chrome/browser/shell_integration.h" 22 #include "chrome/browser/shell_integration.h"
23 #endif 23 #endif
24 24
25 #if defined(USE_ASH) 25 #if defined(USE_ASH)
26 namespace ash { 26 namespace ash {
27 class ImmersiveFullscreenController; 27 class ImmersiveFullscreenController;
28 } 28 }
29 #endif 29 #endif
30 30
31 class ExtensionKeybindingRegistryViews; 31 class ExtensionKeybindingRegistryViews;
32 32
33 namespace apps { 33 namespace apps {
34 class ShellWindowFrameView; 34 class AppWindowFrameView;
35 } 35 }
36 36
37 namespace content { 37 namespace content {
38 class BrowserContext; 38 class BrowserContext;
39 class RenderViewHost; 39 class RenderViewHost;
40 class WebContents; 40 class WebContents;
41 } 41 }
42 42
43 namespace extensions { 43 namespace extensions {
44 class Extension; 44 class Extension;
45 } 45 }
46 46
47 namespace ui { 47 namespace ui {
48 class MenuModel; 48 class MenuModel;
49 } 49 }
50 50
51 namespace views { 51 namespace views {
52 class MenuRunner; 52 class MenuRunner;
53 class WebView; 53 class WebView;
54 } 54 }
55 55
56 class NativeAppWindowViews : public apps::NativeAppWindow, 56 class NativeAppWindowViews : public apps::NativeAppWindow,
57 public content::WebContentsObserver, 57 public content::WebContentsObserver,
58 public views::ContextMenuController, 58 public views::ContextMenuController,
59 public views::WidgetDelegateView, 59 public views::WidgetDelegateView,
60 public views::WidgetObserver { 60 public views::WidgetObserver {
61 public: 61 public:
62 NativeAppWindowViews(); 62 NativeAppWindowViews();
63 virtual ~NativeAppWindowViews(); 63 virtual ~NativeAppWindowViews();
64 void Init(apps::ShellWindow* shell_window, 64 void Init(apps::AppWindow* app_window,
65 const apps::ShellWindow::CreateParams& create_params); 65 const apps::AppWindow::CreateParams& create_params);
66 66
67 SkRegion* shape() { return shape_.get(); } 67 SkRegion* shape() { return shape_.get(); }
68 68
69 protected: 69 protected:
70 // Called before views::Widget::Init() to allow subclasses to customize 70 // Called before views::Widget::Init() to allow subclasses to customize
71 // the InitParams that would be passed. 71 // the InitParams that would be passed.
72 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params, 72 virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params,
73 views::Widget* widget); 73 views::Widget* widget);
74 74
75 // ui::BaseWindow implementation that subclasses may override. 75 // ui::BaseWindow implementation that subclasses may override.
76 virtual void Show() OVERRIDE; 76 virtual void Show() OVERRIDE;
77 virtual void Activate() OVERRIDE; 77 virtual void Activate() OVERRIDE;
78 78
79 content::BrowserContext* browser_context() { 79 content::BrowserContext* browser_context() {
80 return shell_window_->browser_context(); 80 return app_window_->browser_context();
81 } 81 }
82 82
83 const extensions::Extension* extension() { 83 const extensions::Extension* extension() { return app_window_->extension(); }
84 return shell_window_->extension();
85 }
86 84
87 private: 85 private:
88 friend class ShapedAppWindowTargeterTest; 86 friend class ShapedAppWindowTargeterTest;
89 87
90 void InitializeDefaultWindow( 88 void InitializeDefaultWindow(
91 const apps::ShellWindow::CreateParams& create_params); 89 const apps::AppWindow::CreateParams& create_params);
92 void InitializePanelWindow( 90 void InitializePanelWindow(
93 const apps::ShellWindow::CreateParams& create_params); 91 const apps::AppWindow::CreateParams& create_params);
94 void OnViewWasResized(); 92 void OnViewWasResized();
95 93
96 bool ShouldUseChromeStyleFrame() const; 94 bool ShouldUseChromeStyleFrame() const;
97 95
98 // Caller owns the returned object. 96 // Caller owns the returned object.
99 apps::ShellWindowFrameView* CreateShellWindowFrameView(); 97 apps::AppWindowFrameView* CreateAppWindowFrameView();
100 98
101 #if defined(OS_WIN) 99 #if defined(OS_WIN)
102 void OnShortcutInfoLoaded( 100 void OnShortcutInfoLoaded(
103 const ShellIntegration::ShortcutInfo& shortcut_info); 101 const ShellIntegration::ShortcutInfo& shortcut_info);
104 HWND GetNativeAppWindowHWND() const; 102 HWND GetNativeAppWindowHWND() const;
105 #endif 103 #endif
106 104
107 // ui::BaseWindow implementation. 105 // ui::BaseWindow implementation.
108 virtual bool IsActive() const OVERRIDE; 106 virtual bool IsActive() const OVERRIDE;
109 virtual bool IsMaximized() const OVERRIDE; 107 virtual bool IsMaximized() const OVERRIDE;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 196
199 // web_modal::WebContentsModalDialogHost implementation. 197 // web_modal::WebContentsModalDialogHost implementation.
200 virtual gfx::NativeView GetHostView() const OVERRIDE; 198 virtual gfx::NativeView GetHostView() const OVERRIDE;
201 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; 199 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE;
202 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; 200 virtual gfx::Size GetMaximumDialogSize() OVERRIDE;
203 virtual void AddObserver( 201 virtual void AddObserver(
204 web_modal::ModalDialogHostObserver* observer) OVERRIDE; 202 web_modal::ModalDialogHostObserver* observer) OVERRIDE;
205 virtual void RemoveObserver( 203 virtual void RemoveObserver(
206 web_modal::ModalDialogHostObserver* observer) OVERRIDE; 204 web_modal::ModalDialogHostObserver* observer) OVERRIDE;
207 205
208 content::WebContents* web_contents() { 206 content::WebContents* web_contents() { return app_window_->web_contents(); }
209 return shell_window_->web_contents();
210 }
211 207
212 apps::ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. 208 apps::AppWindow* app_window_; // Not owned.
213 views::WebView* web_view_; 209 views::WebView* web_view_;
214 views::Widget* window_; 210 views::Widget* window_;
215 bool is_fullscreen_; 211 bool is_fullscreen_;
216 212
217 // Custom shape of the window. If this is not set then the window has a 213 // Custom shape of the window. If this is not set then the window has a
218 // default shape, usually rectangular. 214 // default shape, usually rectangular.
219 scoped_ptr<SkRegion> shape_; 215 scoped_ptr<SkRegion> shape_;
220 216
221 scoped_ptr<SkRegion> draggable_region_; 217 scoped_ptr<SkRegion> draggable_region_;
222 218
(...skipping 20 matching lines...) Expand all
243 239
244 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; 240 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_;
245 241
246 // Used to show the system menu. 242 // Used to show the system menu.
247 scoped_ptr<views::MenuRunner> menu_runner_; 243 scoped_ptr<views::MenuRunner> menu_runner_;
248 244
249 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); 245 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews);
250 }; 246 };
251 247
252 #endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ 248 #endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698