OLD | NEW |
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 APPS_SHELL_WINDOW_H_ | 5 #ifndef APPS_SHELL_WINDOW_H_ |
6 #define APPS_SHELL_WINDOW_H_ | 6 #define APPS_SHELL_WINDOW_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/extensions/extension_icon_image.h" | 10 #include "chrome/browser/extensions/extension_icon_image.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). | 85 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). |
86 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate | 86 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate |
87 // with v1 apps. | 87 // with v1 apps. |
88 }; | 88 }; |
89 | 89 |
90 enum Frame { | 90 enum Frame { |
91 FRAME_CHROME, // Chrome-style window frame. | 91 FRAME_CHROME, // Chrome-style window frame. |
92 FRAME_NONE, // Frameless window. | 92 FRAME_NONE, // Frameless window. |
93 }; | 93 }; |
94 | 94 |
| 95 enum FullscreenType { |
| 96 // Not fullscreen. |
| 97 FULLSCREEN_TYPE_NONE = 0, |
| 98 |
| 99 // Fullscreen entered by the app.window api. |
| 100 FULLSCREEN_TYPE_WINDOW_API = 1 << 0, |
| 101 |
| 102 // Fullscreen entered by HTML requestFullscreen(). |
| 103 FULLSCREEN_TYPE_HTML_API = 1 << 1, |
| 104 |
| 105 // Fullscreen entered by the OS. ChromeOS uses this type of fullscreen to |
| 106 // enter immersive fullscreen when the user hits the <F4> key. |
| 107 FULLSCREEN_TYPE_OS = 1 << 2 |
| 108 }; |
| 109 |
95 class SizeConstraints { | 110 class SizeConstraints { |
96 public: | 111 public: |
97 // The value SizeConstraints uses to represent an unbounded width or height. | 112 // The value SizeConstraints uses to represent an unbounded width or height. |
98 // This is an enum so that it can be declared inline here. | 113 // This is an enum so that it can be declared inline here. |
99 enum { kUnboundedSize = 0 }; | 114 enum { kUnboundedSize = 0 }; |
100 | 115 |
101 SizeConstraints(); | 116 SizeConstraints(); |
102 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size); | 117 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size); |
103 ~SizeConstraints(); | 118 ~SizeConstraints(); |
104 | 119 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // callback. Also called externally for v1 apps using Ash Panels. | 292 // callback. Also called externally for v1 apps using Ash Panels. |
278 void UpdateAppIcon(const gfx::Image& image); | 293 void UpdateAppIcon(const gfx::Image& image); |
279 | 294 |
280 // Transitions window into fullscreen, maximized, minimized or restores based | 295 // Transitions window into fullscreen, maximized, minimized or restores based |
281 // on chrome.app.window API. | 296 // on chrome.app.window API. |
282 void Fullscreen(); | 297 void Fullscreen(); |
283 void Maximize(); | 298 void Maximize(); |
284 void Minimize(); | 299 void Minimize(); |
285 void Restore(); | 300 void Restore(); |
286 | 301 |
| 302 // Transitions to OS fullscreen. See FULLSCREEN_TYPE_OS for more details. |
| 303 void OSFullscreen(); |
| 304 |
287 // Set the minimum and maximum size that this window is allowed to be. | 305 // Set the minimum and maximum size that this window is allowed to be. |
288 void SetMinimumSize(const gfx::Size& min_size); | 306 void SetMinimumSize(const gfx::Size& min_size); |
289 void SetMaximumSize(const gfx::Size& max_size); | 307 void SetMaximumSize(const gfx::Size& max_size); |
290 | 308 |
291 enum ShowType { | 309 enum ShowType { |
292 SHOW_ACTIVE, | 310 SHOW_ACTIVE, |
293 SHOW_INACTIVE | 311 SHOW_INACTIVE |
294 }; | 312 }; |
295 | 313 |
296 // Shows the window if its contents have been painted; otherwise flags the | 314 // Shows the window if its contents have been painted; otherwise flags the |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 455 |
438 // An object to load the app's icon as an extension resource. | 456 // An object to load the app's icon as an extension resource. |
439 scoped_ptr<extensions::IconImage> app_icon_image_; | 457 scoped_ptr<extensions::IconImage> app_icon_image_; |
440 | 458 |
441 scoped_ptr<NativeAppWindow> native_app_window_; | 459 scoped_ptr<NativeAppWindow> native_app_window_; |
442 scoped_ptr<ShellWindowContents> shell_window_contents_; | 460 scoped_ptr<ShellWindowContents> shell_window_contents_; |
443 scoped_ptr<Delegate> delegate_; | 461 scoped_ptr<Delegate> delegate_; |
444 | 462 |
445 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; | 463 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; |
446 | 464 |
447 // Fullscreen entered by app.window api. | 465 // Bit field of FullscreenType. |
448 bool fullscreen_for_window_api_; | 466 int fullscreen_types_; |
449 // Fullscreen entered by HTML requestFullscreen. | |
450 bool fullscreen_for_tab_; | |
451 | 467 |
452 // Size constraints on the window. | 468 // Size constraints on the window. |
453 SizeConstraints size_constraints_; | 469 SizeConstraints size_constraints_; |
454 | 470 |
455 // Show has been called, so the window should be shown once the first visually | 471 // Show has been called, so the window should be shown once the first visually |
456 // non-empty paint occurs. | 472 // non-empty paint occurs. |
457 bool show_on_first_paint_; | 473 bool show_on_first_paint_; |
458 | 474 |
459 // The first visually non-empty paint has completed. | 475 // The first visually non-empty paint has completed. |
460 bool first_paint_complete_; | 476 bool first_paint_complete_; |
461 | 477 |
462 // Whether the delayed Show() call was for an active or inactive window. | 478 // Whether the delayed Show() call was for an active or inactive window. |
463 ShowType delayed_show_type_; | 479 ShowType delayed_show_type_; |
464 | 480 |
465 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 481 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
466 }; | 482 }; |
467 | 483 |
468 } // namespace apps | 484 } // namespace apps |
469 | 485 |
470 #endif // APPS_SHELL_WINDOW_H_ | 486 #endif // APPS_SHELL_WINDOW_H_ |
OLD | NEW |