OLD | NEW |
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 APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ | 5 #ifndef APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ |
6 #define APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ | 6 #define APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ |
7 | 7 |
8 #include "apps/app_window.h" | |
9 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
10 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "extensions/browser/app_window/app_window.h" |
11 #include "extensions/browser/app_window/native_app_window.h" | 11 #include "extensions/browser/app_window/native_app_window.h" |
12 #include "extensions/browser/app_window/size_constraints.h" | 12 #include "extensions/browser/app_window/size_constraints.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 14 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
17 #include "ui/views/widget/widget_observer.h" | 17 #include "ui/views/widget/widget_observer.h" |
18 | 18 |
19 class SkRegion; | 19 class SkRegion; |
20 | 20 |
(...skipping 22 matching lines...) Expand all Loading... |
43 | 43 |
44 // A NativeAppWindow backed by a views::Widget. This class may be used alone | 44 // A NativeAppWindow backed by a views::Widget. This class may be used alone |
45 // as a stub or subclassed (for example, ChromeNativeAppWindowViews). | 45 // as a stub or subclassed (for example, ChromeNativeAppWindowViews). |
46 class NativeAppWindowViews : public extensions::NativeAppWindow, | 46 class NativeAppWindowViews : public extensions::NativeAppWindow, |
47 public content::WebContentsObserver, | 47 public content::WebContentsObserver, |
48 public views::WidgetDelegateView, | 48 public views::WidgetDelegateView, |
49 public views::WidgetObserver { | 49 public views::WidgetObserver { |
50 public: | 50 public: |
51 NativeAppWindowViews(); | 51 NativeAppWindowViews(); |
52 virtual ~NativeAppWindowViews(); | 52 virtual ~NativeAppWindowViews(); |
53 void Init(AppWindow* app_window, | 53 void Init(extensions::AppWindow* app_window, |
54 const AppWindow::CreateParams& create_params); | 54 const extensions::AppWindow::CreateParams& create_params); |
55 | 55 |
56 // Signal that CanHaveTransparentBackground has changed. | 56 // Signal that CanHaveTransparentBackground has changed. |
57 void OnCanHaveAlphaEnabledChanged(); | 57 void OnCanHaveAlphaEnabledChanged(); |
58 | 58 |
59 views::Widget* widget() { return widget_; } | 59 views::Widget* widget() { return widget_; } |
60 | 60 |
61 void set_window_for_testing(views::Widget* window) { widget_ = window; } | 61 void set_window_for_testing(views::Widget* window) { widget_ = window; } |
62 void set_web_view_for_testing(views::WebView* view) { web_view_ = view; } | 62 void set_web_view_for_testing(views::WebView* view) { web_view_ = view; } |
63 | 63 |
64 protected: | 64 protected: |
65 AppWindow* app_window() { return app_window_; } | 65 extensions::AppWindow* app_window() { return app_window_; } |
66 const AppWindow* app_window() const { return app_window_; } | 66 const extensions::AppWindow* app_window() const { return app_window_; } |
67 | 67 |
68 const views::Widget* widget() const { return widget_; } | 68 const views::Widget* widget() const { return widget_; } |
69 | 69 |
70 views::WebView* web_view() { return web_view_; } | 70 views::WebView* web_view() { return web_view_; } |
71 | 71 |
72 // Initializes |widget_| for |app_window|. | 72 // Initializes |widget_| for |app_window|. |
73 virtual void InitializeWindow(AppWindow* app_window, | 73 virtual void InitializeWindow( |
74 const AppWindow::CreateParams& create_params); | 74 extensions::AppWindow* app_window, |
| 75 const extensions::AppWindow::CreateParams& create_params); |
75 | 76 |
76 // ui::BaseWindow implementation. | 77 // ui::BaseWindow implementation. |
77 virtual bool IsActive() const OVERRIDE; | 78 virtual bool IsActive() const OVERRIDE; |
78 virtual bool IsMaximized() const OVERRIDE; | 79 virtual bool IsMaximized() const OVERRIDE; |
79 virtual bool IsMinimized() const OVERRIDE; | 80 virtual bool IsMinimized() const OVERRIDE; |
80 virtual bool IsFullscreen() const OVERRIDE; | 81 virtual bool IsFullscreen() const OVERRIDE; |
81 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 82 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
82 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | 83 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
83 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; | 84 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; |
84 virtual gfx::Rect GetBounds() const OVERRIDE; | 85 virtual gfx::Rect GetBounds() const OVERRIDE; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; | 168 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; |
168 virtual void AddObserver( | 169 virtual void AddObserver( |
169 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 170 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
170 virtual void RemoveObserver( | 171 virtual void RemoveObserver( |
171 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 172 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
172 | 173 |
173 private: | 174 private: |
174 // Informs modal dialogs that they need to update their positions. | 175 // Informs modal dialogs that they need to update their positions. |
175 void OnViewWasResized(); | 176 void OnViewWasResized(); |
176 | 177 |
177 AppWindow* app_window_; // Not owned. | 178 extensions::AppWindow* app_window_; // Not owned. |
178 views::WebView* web_view_; | 179 views::WebView* web_view_; |
179 views::Widget* widget_; | 180 views::Widget* widget_; |
180 | 181 |
181 scoped_ptr<SkRegion> draggable_region_; | 182 scoped_ptr<SkRegion> draggable_region_; |
182 | 183 |
183 bool frameless_; | 184 bool frameless_; |
184 bool resizable_; | 185 bool resizable_; |
185 extensions::SizeConstraints size_constraints_; | 186 extensions::SizeConstraints size_constraints_; |
186 | 187 |
187 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 188 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
188 | 189 |
189 ObserverList<web_modal::ModalDialogHostObserver> observer_list_; | 190 ObserverList<web_modal::ModalDialogHostObserver> observer_list_; |
190 | 191 |
191 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); | 192 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); |
192 }; | 193 }; |
193 | 194 |
194 } // namespace apps | 195 } // namespace apps |
195 | 196 |
196 #endif // APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ | 197 #endif // APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ |
OLD | NEW |