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

Side by Side Diff: chrome/browser/ui/views/extensions/app_base_window_views.h

Issue 11280173: Rename ShellWindow* classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac build Created 8 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_APP_BASE_WINDOW_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_APP_BASE_WINDOW_VIEWS_H_
7 7
8 #include "chrome/browser/ui/base_window.h" 8 #include "chrome/browser/ui/extensions/app_base_window.h"
9 #include "chrome/browser/ui/extensions/native_shell_window.h"
10 #include "chrome/browser/ui/extensions/shell_window.h"
11 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" 9 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
12 #include "third_party/skia/include/core/SkRegion.h"
13 #include "ui/gfx/image/image_skia.h" 10 #include "ui/gfx/image/image_skia.h"
14 #include "ui/gfx/rect.h" 11 #include "ui/gfx/rect.h"
15 #include "ui/views/widget/widget_delegate.h" 12 #include "ui/views/widget/widget_delegate.h"
16 13
17 class ExtensionKeybindingRegistryViews; 14 class ExtensionKeybindingRegistryViews;
18 class Profile; 15 class Profile;
16 class SkRegion;
19 17
20 namespace content { 18 namespace content {
21 class WebContents; 19 class WebContents;
22 } 20 }
23 21
24 namespace extensions { 22 namespace extensions {
25 class Extension; 23 class Extension;
24 class ShellWindow;
26 } 25 }
27 26
28 namespace views { 27 namespace views {
29 class WebView; 28 class WebView;
30 } 29 }
31 30
32 class ShellWindowViews : public NativeShellWindow, 31 class AppBaseWindowViews : public AppBaseWindow,
33 public views::WidgetDelegateView { 32 public views::WidgetDelegateView {
34 public: 33 public:
35 ShellWindowViews(ShellWindow* shell_window, 34 AppBaseWindowViews(ShellWindow* shell_window,
36 const ShellWindow::CreateParams& params); 35 const ShellWindow::CreateParams& params);
36 virtual ~AppBaseWindowViews();
37
38 // This must be called after construction (i.e. in AppBaseWindow::Create).
39 void Initialize(const ShellWindow::CreateParams& params);
37 40
38 bool frameless() const { return frameless_; } 41 bool frameless() const { return frameless_; }
39 SkRegion* draggable_region() { return draggable_region_.get(); } 42 SkRegion* draggable_region() { return draggable_region_.get(); }
40 43
41 // BaseWindow implementation. 44 // BaseWindow implementation.
42 virtual bool IsActive() const OVERRIDE; 45 virtual bool IsActive() const OVERRIDE;
43 virtual bool IsMaximized() const OVERRIDE; 46 virtual bool IsMaximized() const OVERRIDE;
44 virtual bool IsMinimized() const OVERRIDE; 47 virtual bool IsMinimized() const OVERRIDE;
45 virtual bool IsFullscreen() const OVERRIDE; 48 virtual bool IsFullscreen() const OVERRIDE;
46 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 49 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
47 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 50 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
48 virtual gfx::Rect GetBounds() const OVERRIDE; 51 virtual gfx::Rect GetBounds() const OVERRIDE;
49 virtual void Show() OVERRIDE; 52 virtual void Show() OVERRIDE;
50 virtual void ShowInactive() OVERRIDE; 53 virtual void ShowInactive() OVERRIDE;
51 virtual void Hide() OVERRIDE; 54 virtual void Hide() OVERRIDE;
52 virtual void Close() OVERRIDE; 55 virtual void Close() OVERRIDE;
53 virtual void Activate() OVERRIDE; 56 virtual void Activate() OVERRIDE;
54 virtual void Deactivate() OVERRIDE; 57 virtual void Deactivate() OVERRIDE;
55 virtual void Maximize() OVERRIDE; 58 virtual void Maximize() OVERRIDE;
56 virtual void Minimize() OVERRIDE; 59 virtual void Minimize() OVERRIDE;
57 virtual void Restore() OVERRIDE; 60 virtual void Restore() OVERRIDE;
58 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 61 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
59 virtual void FlashFrame(bool flash) OVERRIDE; 62 virtual void FlashFrame(bool flash) OVERRIDE;
60 virtual bool IsAlwaysOnTop() const OVERRIDE; 63 virtual bool IsAlwaysOnTop() const OVERRIDE;
61 64
62 // WidgetDelegate implementation. 65 // WidgetDelegate implementation.
63 virtual views::View* GetContentsView() OVERRIDE; 66 virtual views::View* GetContentsView() OVERRIDE;
64 virtual views::NonClientFrameView* CreateNonClientFrameView(
65 views::Widget* widget) OVERRIDE;
66 virtual bool CanResize() const OVERRIDE; 67 virtual bool CanResize() const OVERRIDE;
67 virtual bool CanMaximize() const OVERRIDE; 68 virtual bool CanMaximize() const OVERRIDE;
68 virtual views::Widget* GetWidget() OVERRIDE; 69 virtual views::Widget* GetWidget() OVERRIDE;
69 virtual const views::Widget* GetWidget() const OVERRIDE; 70 virtual const views::Widget* GetWidget() const OVERRIDE;
70 virtual string16 GetWindowTitle() const OVERRIDE; 71 virtual string16 GetWindowTitle() const OVERRIDE;
71 virtual void DeleteDelegate() OVERRIDE; 72 virtual void DeleteDelegate() OVERRIDE;
72 virtual views::View* GetInitiallyFocusedView() OVERRIDE; 73 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
73 virtual bool ShouldDescendIntoChildForEventHandling( 74 virtual bool ShouldDescendIntoChildForEventHandling(
74 gfx::NativeView child, 75 gfx::NativeView child,
75 const gfx::Point& location) OVERRIDE; 76 const gfx::Point& location) OVERRIDE;
76 virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; 77 virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE;
77 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; 78 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
78 virtual bool ShouldShowWindowTitle() const OVERRIDE; 79 virtual bool ShouldShowWindowTitle() const OVERRIDE;
79 virtual void OnWidgetMove() OVERRIDE; 80 virtual void OnWidgetMove() OVERRIDE;
80 81
81 protected: 82 protected:
82 // views::View implementation. 83 ShellWindow* shell_window() { return shell_window_; }
83 virtual void Layout() OVERRIDE; 84 views::WebView* web_view() { return web_view_; }
84 virtual void ViewHierarchyChanged( 85 views::Widget* window() { return window_; }
85 bool is_add, views::View *parent, views::View *child) OVERRIDE; 86 ExtensionKeybindingRegistryViews* extension_keybinding_registry() {
86 virtual gfx::Size GetMinimumSize() OVERRIDE; 87 return extension_keybinding_registry_.get();
87 virtual gfx::Size GetMaximumSize() OVERRIDE; 88 }
88 virtual void OnFocus() OVERRIDE;
89 89
90 Profile* profile() { return shell_window_->profile(); } 90 Profile* profile() { return shell_window_->profile(); }
91 content::WebContents* web_contents() { 91 content::WebContents* web_contents() {
92 return shell_window_->web_contents(); 92 return shell_window_->web_contents();
93 } 93 }
94 const extensions::Extension* extension() { 94 const extensions::Extension* extension() {
95 return shell_window_->extension(); 95 return shell_window_->extension();
96 } 96 }
97 97
98 // InitializeWindow() must be implemented by the implementation class.
99 virtual void InitializeWindow(const gfx::Rect& initial_bounds) = 0;
100
101 // Defaults to a noop. Implement to handle any necessary syncing on resize.
102 virtual void OnViewWasResized();
103
104 private:
105 // views::View implementation.
106 virtual void Layout() OVERRIDE;
107 virtual void ViewHierarchyChanged(
108 bool is_add, views::View *parent, views::View *child) OVERRIDE;
109 virtual gfx::Size GetMinimumSize() OVERRIDE;
110 virtual gfx::Size GetMaximumSize() OVERRIDE;
111 virtual void OnFocus() OVERRIDE;
112
98 // views::WidgetDelegate implementation. 113 // views::WidgetDelegate implementation.
99 virtual void SaveWindowPlacement(const gfx::Rect& bounds, 114 virtual void SaveWindowPlacement(const gfx::Rect& bounds,
100 ui::WindowShowState show_state) OVERRIDE; 115 ui::WindowShowState show_state) OVERRIDE;
101 116
102 private: 117 // AppBaseWindow implementation.
103 friend class ShellWindowFrameView;
104
105 virtual ~ShellWindowViews();
106
107 // NativeShellWindow implementation.
108 virtual void SetFullscreen(bool fullscreen) OVERRIDE; 118 virtual void SetFullscreen(bool fullscreen) OVERRIDE;
109 virtual bool IsFullscreenOrPending() const OVERRIDE; 119 virtual bool IsFullscreenOrPending() const OVERRIDE;
110 virtual void UpdateWindowIcon() OVERRIDE; 120 virtual void UpdateWindowIcon() OVERRIDE;
111 virtual void UpdateWindowTitle() OVERRIDE; 121 virtual void UpdateWindowTitle() OVERRIDE;
112 virtual void UpdateDraggableRegions( 122 virtual void UpdateDraggableRegions(
113 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; 123 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
114 virtual void HandleKeyboardEvent( 124 virtual void HandleKeyboardEvent(
115 const content::NativeWebKeyboardEvent& event) OVERRIDE; 125 const content::NativeWebKeyboardEvent& event) OVERRIDE;
116 virtual void RenderViewHostChanged() OVERRIDE; 126 virtual void RenderViewHostChanged() OVERRIDE;
117 127
118 void OnViewWasResized(); 128 // Weak ptr to the ShellWindow instance that owns this.
129 ShellWindow* shell_window_;
119 130
120 ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow. 131 // Pointer to the child web view (owned by the view hierarchy).
132 views::WebView* web_view_;
121 133
122 views::WebView* web_view_; 134 // Unowned window ptr, initialized in InitializeWindow.
123 views::Widget* window_; 135 views::Widget* window_;
136
137 // Tracks the fullscreen state.
124 bool is_fullscreen_; 138 bool is_fullscreen_;
125 139
126 scoped_ptr<SkRegion> draggable_region_; 140 // True if the ShellWindow frame type == FRAME_NONE.
141 bool frameless_;
127 142
128 bool frameless_; 143 // Minimum / maximum window size.
129 gfx::Size minimum_size_; 144 gfx::Size minimum_size_;
130 gfx::Size maximum_size_; 145 gfx::Size maximum_size_;
131 146
147 // Draggable region for frameless windows.
148 scoped_ptr<SkRegion> draggable_region_;
149
132 // The class that registers for keyboard shortcuts for extension commands. 150 // The class that registers for keyboard shortcuts for extension commands.
133 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; 151 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
134 152
153 // Passes unhandled keyboard events to the focus manager or OS.
135 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; 154 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
136 155
137 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); 156 DISALLOW_COPY_AND_ASSIGN(AppBaseWindowViews);
138 }; 157 };
139 158
140 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ 159 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_APP_BASE_WINDOW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698