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_APP_WINDOW_H_ | 5 #ifndef APPS_APP_WINDOW_H_ |
6 #define APPS_APP_WINDOW_H_ | 6 #define APPS_APP_WINDOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 // The API enables developers to specify content or window size constraints. | 190 // The API enables developers to specify content or window size constraints. |
191 // These functions combine them so that we can work with one set of | 191 // These functions combine them so that we can work with one set of |
192 // constraints. | 192 // constraints. |
193 gfx::Size GetContentMinimumSize(const gfx::Insets& frame_insets) const; | 193 gfx::Size GetContentMinimumSize(const gfx::Insets& frame_insets) const; |
194 gfx::Size GetContentMaximumSize(const gfx::Insets& frame_insets) const; | 194 gfx::Size GetContentMaximumSize(const gfx::Insets& frame_insets) const; |
195 gfx::Size GetWindowMinimumSize(const gfx::Insets& frame_insets) const; | 195 gfx::Size GetWindowMinimumSize(const gfx::Insets& frame_insets) const; |
196 gfx::Size GetWindowMaximumSize(const gfx::Insets& frame_insets) const; | 196 gfx::Size GetWindowMaximumSize(const gfx::Insets& frame_insets) const; |
197 }; | 197 }; |
198 | 198 |
199 class Delegate { | |
200 public: | |
201 virtual ~Delegate(); | |
202 | |
203 virtual NativeAppWindow* CreateNativeAppWindow( | |
204 AppWindow* window, | |
205 const CreateParams& params) = 0; | |
206 }; | |
207 | |
208 // Convert draggable regions in raw format to SkRegion format. Caller is | 199 // Convert draggable regions in raw format to SkRegion format. Caller is |
209 // responsible for deleting the returned SkRegion instance. | 200 // responsible for deleting the returned SkRegion instance. |
210 static SkRegion* RawDraggableRegionsToSkRegion( | 201 static SkRegion* RawDraggableRegionsToSkRegion( |
211 const std::vector<extensions::DraggableRegion>& regions); | 202 const std::vector<extensions::DraggableRegion>& regions); |
212 | 203 |
213 // The constructor and Init methods are public for constructing a AppWindow | 204 // The constructor and Init methods are public for constructing a AppWindow |
214 // with a non-standard render interface (e.g. v1 apps using Ash Panels). | 205 // with a non-standard render interface (e.g. v1 apps using Ash Panels). |
215 // Normally AppWindow::Create should be used. | 206 // Normally AppWindow::Create should be used. |
216 // Takes ownership of |app_delegate| and |delegate|. | 207 // Takes ownership of |app_delegate| and |delegate|. |
217 AppWindow(content::BrowserContext* context, | 208 AppWindow(content::BrowserContext* context, |
218 AppDelegate* app_delegate, | 209 AppDelegate* app_delegate, |
219 Delegate* delegate, | |
220 const extensions::Extension* extension); | 210 const extensions::Extension* extension); |
221 | 211 |
222 // Initializes the render interface, web contents, and native window. | 212 // Initializes the render interface, web contents, and native window. |
223 // |app_window_contents| will become owned by AppWindow. | 213 // |app_window_contents| will become owned by AppWindow. |
224 void Init(const GURL& url, | 214 void Init(const GURL& url, |
225 AppWindowContents* app_window_contents, | 215 AppWindowContents* app_window_contents, |
226 const CreateParams& params); | 216 const CreateParams& params); |
227 | 217 |
228 const std::string& window_key() const { return window_key_; } | 218 const std::string& window_key() const { return window_key_; } |
229 const SessionID& session_id() const { return session_id_; } | 219 const SessionID& session_id() const { return session_id_; } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 501 |
512 // URL to be used for setting the badge on the app icon. | 502 // URL to be used for setting the badge on the app icon. |
513 GURL badge_icon_url_; | 503 GURL badge_icon_url_; |
514 | 504 |
515 // An object to load the badge as an extension resource. | 505 // An object to load the badge as an extension resource. |
516 scoped_ptr<extensions::IconImage> badge_icon_image_; | 506 scoped_ptr<extensions::IconImage> badge_icon_image_; |
517 | 507 |
518 scoped_ptr<NativeAppWindow> native_app_window_; | 508 scoped_ptr<NativeAppWindow> native_app_window_; |
519 scoped_ptr<AppWindowContents> app_window_contents_; | 509 scoped_ptr<AppWindowContents> app_window_contents_; |
520 scoped_ptr<AppDelegate> app_delegate_; | 510 scoped_ptr<AppDelegate> app_delegate_; |
521 scoped_ptr<Delegate> delegate_; | |
522 | 511 |
523 // Manages popup windows (bubbles, tab-modals) visible overlapping the | 512 // Manages popup windows (bubbles, tab-modals) visible overlapping the |
524 // app window. | 513 // app window. |
525 scoped_ptr<web_modal::PopupManager> popup_manager_; | 514 scoped_ptr<web_modal::PopupManager> popup_manager_; |
526 | 515 |
527 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; | 516 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; |
528 | 517 |
529 // Bit field of FullscreenType. | 518 // Bit field of FullscreenType. |
530 int fullscreen_types_; | 519 int fullscreen_types_; |
531 | 520 |
(...skipping 30 matching lines...) Expand all Loading... |
562 | 551 |
563 // Whether |transparent_background| was set in the CreateParams. | 552 // Whether |transparent_background| was set in the CreateParams. |
564 bool requested_transparent_background_; | 553 bool requested_transparent_background_; |
565 | 554 |
566 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 555 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
567 }; | 556 }; |
568 | 557 |
569 } // namespace apps | 558 } // namespace apps |
570 | 559 |
571 #endif // APPS_APP_WINDOW_H_ | 560 #endif // APPS_APP_WINDOW_H_ |
OLD | NEW |