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

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

Issue 171523005: BACKUP: NativeAppWindowView - before splitting CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_
6 #define APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_
7
8 #include "apps/app_window.h"
9 #include "apps/ui/native_app_window.h"
10 #include "base/observer_list.h"
11 #include "content/public/browser/web_contents_observer.h"
12 #include "third_party/skia/include/core/SkRegion.h"
13 #include "ui/gfx/image/image_skia.h"
14 #include "ui/gfx/rect.h"
15 //#include "ui/views/context_menu_controller.h"
16 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
17 #include "ui/views/widget/widget.h"
18 #include "ui/views/widget/widget_delegate.h"
19 #include "ui/views/widget/widget_observer.h"
20
21 //#if defined(USE_ASH)
22 //namespace ash {
23 //class ImmersiveFullscreenController;
24 //}
25 //#endif
26
27 namespace apps {
28 class AppWindowFrameView;
29 }
30
31 namespace content {
32 class BrowserContext;
33 class RenderViewHost;
34 class WebContents;
35 }
36
37 namespace extensions {
38 class Extension;
39 }
40
41 namespace ui {
42 class MenuModel;
43 }
44
45 namespace views {
46 class MenuRunner;
47 class WebView;
48 }
49
50 class NativeAppWindowViews : public apps::NativeAppWindow,
51 public content::WebContentsObserver,
52 // public views::ContextMenuController,
53 public views::WidgetDelegateView,
54 public views::WidgetObserver {
55 public:
56 NativeAppWindowViews();
57 virtual ~NativeAppWindowViews();
58 void Init(apps::AppWindow* app_window,
59 const apps::AppWindow::CreateParams& create_params);
60
61 SkRegion* shape() { return shape_.get(); }
62
63 protected:
64 // Initializes the views::Widget for |app_window|.
65 virtual void InitializeWindow(
66 apps::AppWindow* app_window,
67 const apps::AppWindow::CreateParams& create_params) = 0;
68
69 // // Called before views::Widget::Init() to allow subclasses to customize
70 // // the InitParams that would be passed.
71 // virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params,
72 // views::Widget* widget);
73
74 // ui::BaseWindow implementation that subclasses may override.
75 virtual bool IsMaximized() const OVERRIDE;//for access
76 virtual bool IsFullscreen() const OVERRIDE;//for access
77 virtual void Show() OVERRIDE;
78 virtual void Activate() OVERRIDE;
79 virtual void Close() OVERRIDE;
80
81 //james - make the whole thing protected? re-order the .cc file?
82 //nativeappwindow:
83 virtual bool IsFrameless() const OVERRIDE;//for access
84 virtual gfx::Insets GetFrameInsets() const OVERRIDE;//for access
85
86 content::BrowserContext* browser_context() {
87 return app_window_->browser_context();
88 }
89
90 const extensions::Extension* extension() { return app_window_->extension(); }
91 views::Widget* window() { return window_; }
92 const views::Widget* window() const { return window_; }
93 views::WebView* web_view() { return web_view_; }
94 const apps::AppWindow* app_window() const { return app_window_; }
95
96 // virtual void InitializeDefaultWindow(
97 // const apps::AppWindow::CreateParams& create_params);
98 // virtual void InitializePanelWindow(
99 // const apps::AppWindow::CreateParams& create_params);
100
101 // bool ShouldUseChromeStyleFrame() const;
102
103 // // Caller owns the returned object.
104 // apps::AppWindowFrameView* CreateAppWindowFrameView();
105
106 // ui::BaseWindow implementation.
107 virtual bool IsActive() const OVERRIDE;
108 // virtual bool IsMaximized() const OVERRIDE;
109 virtual bool IsMinimized() const OVERRIDE;
110 // virtual bool IsFullscreen() const OVERRIDE;
111 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
112 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
113 virtual ui::WindowShowState GetRestoredState() const OVERRIDE;
114 virtual gfx::Rect GetBounds() const OVERRIDE;
115 virtual void ShowInactive() OVERRIDE;
116 virtual void Hide() OVERRIDE;
117 // virtual void Close() OVERRIDE;
118 virtual void Deactivate() OVERRIDE;
119 virtual void Maximize() OVERRIDE;
120 virtual void Minimize() OVERRIDE;
121 virtual void Restore() OVERRIDE;
122 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
123 virtual void FlashFrame(bool flash) OVERRIDE;
124 // virtual bool IsAlwaysOnTop() const OVERRIDE;
125 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
126
127 // // Overridden from views::ContextMenuController:
128 // virtual void ShowContextMenuForView(views::View* source,
129 // const gfx::Point& p,
130 // ui::MenuSourceType source_type) OVERRIDE ;
131
132 // WidgetDelegate implementation.
133 virtual void OnWidgetMove() OVERRIDE;
134 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
135 virtual bool CanResize() const OVERRIDE;
136 virtual bool CanMaximize() const OVERRIDE;
137 virtual base::string16 GetWindowTitle() const OVERRIDE;
138 virtual bool ShouldShowWindowTitle() const OVERRIDE;
139 virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE;
140 // virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
141 virtual bool ShouldShowWindowIcon() const OVERRIDE;
142 virtual void SaveWindowPlacement(const gfx::Rect& bounds,
143 ui::WindowShowState show_state) OVERRIDE;
144 virtual void DeleteDelegate() OVERRIDE;
145 virtual views::Widget* GetWidget() OVERRIDE;
146 virtual const views::Widget* GetWidget() const OVERRIDE;
147 virtual views::View* GetContentsView() OVERRIDE;
148 // virtual views::NonClientFrameView* CreateNonClientFrameView(
149 // views::Widget* widget) OVERRIDE;
150 virtual bool WidgetHasHitTestMask() const OVERRIDE;
151 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE;
152 virtual bool ShouldDescendIntoChildForEventHandling(
153 gfx::NativeView child,
154 const gfx::Point& location) OVERRIDE;
155
156 // WidgetObserver implementation.
157 virtual void OnWidgetVisibilityChanged(views::Widget* widget,
158 bool visible) OVERRIDE;
159 virtual void OnWidgetActivationChanged(views::Widget* widget,
160 bool active) OVERRIDE;
161
162 // WebContentsObserver implementation.
163 virtual void RenderViewCreated(
164 content::RenderViewHost* render_view_host) OVERRIDE;
165 virtual void RenderViewHostChanged(
166 content::RenderViewHost* old_host,
167 content::RenderViewHost* new_host) OVERRIDE;
168
169 // views::View implementation.
170 virtual void Layout() OVERRIDE;
171 virtual void ViewHierarchyChanged(
172 const ViewHierarchyChangedDetails& details) OVERRIDE;
173 // virtual gfx::Size GetPreferredSize() OVERRIDE;
174 virtual gfx::Size GetMinimumSize() OVERRIDE;
175 virtual gfx::Size GetMaximumSize() OVERRIDE;
176 virtual void OnFocus() OVERRIDE;
177
178 // NativeAppWindow implementation.
179 // virtual void SetFullscreen(int fullscreen_types) OVERRIDE;
180 // virtual bool IsFullscreenOrPending() const OVERRIDE;
181 // virtual bool IsDetached() const OVERRIDE;
182 virtual void UpdateWindowIcon() OVERRIDE;
183 virtual void UpdateWindowTitle() OVERRIDE;
184 // virtual void UpdateBadgeIcon() OVERRIDE;
185 virtual void UpdateDraggableRegions(
186 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
187 virtual SkRegion* GetDraggableRegion() OVERRIDE;
188 virtual void UpdateShape(scoped_ptr<SkRegion> region) OVERRIDE;
189 virtual void HandleKeyboardEvent(
190 const content::NativeWebKeyboardEvent& event) OVERRIDE;
191 // virtual bool IsFrameless() const OVERRIDE;
192 // virtual gfx::Insets GetFrameInsets() const OVERRIDE;
193 virtual void HideWithApp() OVERRIDE;
194 virtual void ShowWithApp() OVERRIDE;
195 virtual void UpdateWindowMinMaxSize() OVERRIDE;
196
197 // web_modal::WebContentsModalDialogHost implementation.
198 virtual gfx::NativeView GetHostView() const OVERRIDE;
199 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE;
200 virtual gfx::Size GetMaximumDialogSize() OVERRIDE;
201 virtual void AddObserver(
202 web_modal::ModalDialogHostObserver* observer) OVERRIDE;
203 virtual void RemoveObserver(
204 web_modal::ModalDialogHostObserver* observer) OVERRIDE;
205
206 private:
207 friend class ShapedAppWindowTargeterTest;
208
209 void OnViewWasResized();
210
211 // content::WebContents* web_contents() { return app_window_->web_contents(); }
212
213 apps::AppWindow* app_window_; // Not owned.
214 views::WebView* web_view_;
215 views::Widget* window_;
216 // bool is_fullscreen_;
217
218 // Custom shape of the window. If this is not set then the window has a
219 // default shape, usually rectangular.
220 scoped_ptr<SkRegion> shape_;
221
222 scoped_ptr<SkRegion> draggable_region_;
223
224 bool frameless_;
225 bool transparent_background_;
226 // gfx::Size preferred_size_;
227 bool resizable_;
228
229 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
230
231 //#if defined(USE_ASH)
232 // // Used to put non-frameless windows into immersive fullscreen on ChromeOS. In
233 // // immersive fullscreen, the window header (title bar and window controls)
234 // // slides onscreen as an overlay when the mouse is hovered at the top of the
235 // // screen.
236 // scoped_ptr<ash::ImmersiveFullscreenController>
237 // immersive_fullscreen_controller_;
238 //#endif
239
240 ObserverList<web_modal::ModalDialogHostObserver> observer_list_;
241
242 // base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_;
243
244 // // Used to show the system menu.
245 // scoped_ptr<views::MenuRunner> menu_runner_;
246
247 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews);
248 };
249
250 #endif // APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_
OLDNEW
« no previous file with comments | « apps/shell/browser/shell_shell_window_delegate.cc ('k') | apps/ui/views/native_app_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698