Chromium Code Reviews| 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 // Normal fullscreen. Primarily used by the app.window api. | |
| 97 FULLSCREEN_TYPE_WINDOW, | |
| 98 | |
| 99 // Fullscreen entered by HTML requestFullscreen. | |
| 100 FULLSCREEN_TYPE_TAB, | |
| 101 | |
| 102 // Combination of "window" fullscreen and fullscreen entered by HTML | |
| 103 // requestFullscreen. | |
| 104 FULLSCREEN_TYPE_WINDOW_AND_TAB, | |
| 105 | |
| 106 // Fullscreen entered by <F4> hitting on ChromeOS. In immersive fullscreen, | |
| 107 // the window header (title bar and window controls) slides onscreen as an | |
| 108 // overlay when the mouse is hovered at the top of the screen. | |
| 109 FULLSCREEN_TYPE_IMMERSIVE, | |
|
oshima
2013/11/07 18:56:13
Can you explain in the comment how other three typ
| |
| 110 | |
| 111 // Not fullscreen. | |
| 112 FULLSCREEN_TYPE_NONE | |
| 113 }; | |
| 114 | |
| 95 class SizeConstraints { | 115 class SizeConstraints { |
| 96 public: | 116 public: |
| 97 // The value SizeConstraints uses to represent an unbounded width or height. | 117 // The value SizeConstraints uses to represent an unbounded width or height. |
| 98 // This is an enum so that it can be declared inline here. | 118 // This is an enum so that it can be declared inline here. |
| 99 enum { kUnboundedSize = 0 }; | 119 enum { kUnboundedSize = 0 }; |
| 100 | 120 |
| 101 SizeConstraints(); | 121 SizeConstraints(); |
| 102 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size); | 122 SizeConstraints(const gfx::Size& min_size, const gfx::Size& max_size); |
| 103 ~SizeConstraints(); | 123 ~SizeConstraints(); |
| 104 | 124 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 // callback. Also called externally for v1 apps using Ash Panels. | 297 // callback. Also called externally for v1 apps using Ash Panels. |
| 278 void UpdateAppIcon(const gfx::Image& image); | 298 void UpdateAppIcon(const gfx::Image& image); |
| 279 | 299 |
| 280 // Transitions window into fullscreen, maximized, minimized or restores based | 300 // Transitions window into fullscreen, maximized, minimized or restores based |
| 281 // on chrome.app.window API. | 301 // on chrome.app.window API. |
| 282 void Fullscreen(); | 302 void Fullscreen(); |
| 283 void Maximize(); | 303 void Maximize(); |
| 284 void Minimize(); | 304 void Minimize(); |
| 285 void Restore(); | 305 void Restore(); |
| 286 | 306 |
| 307 // Transitions into immersive fullscreen. In immersive fullscreen, the window | |
| 308 // header (title bar and window controls) slides onscreen as an overlay when | |
| 309 // the mouse is hovered at the top of the screen. This is a no-op if the | |
| 310 // window does not support immersive fullscreen. | |
|
oshima
2013/11/07 18:56:13
You can just refer to enum description.
| |
| 311 void ImmersiveFullscreen(); | |
| 312 | |
|
oshima
2013/11/07 18:56:13
nuke extra new line
| |
| 313 | |
| 287 // Set the minimum and maximum size that this window is allowed to be. | 314 // Set the minimum and maximum size that this window is allowed to be. |
| 288 void SetMinimumSize(const gfx::Size& min_size); | 315 void SetMinimumSize(const gfx::Size& min_size); |
| 289 void SetMaximumSize(const gfx::Size& max_size); | 316 void SetMaximumSize(const gfx::Size& max_size); |
| 290 | 317 |
| 291 enum ShowType { | 318 enum ShowType { |
| 292 SHOW_ACTIVE, | 319 SHOW_ACTIVE, |
| 293 SHOW_INACTIVE | 320 SHOW_INACTIVE |
| 294 }; | 321 }; |
| 295 | 322 |
| 296 // Shows the window if its contents have been painted; otherwise flags the | 323 // Shows the window if its contents have been painted; otherwise flags the |
| 297 // window to be shown as soon as its contents are painted for the first time. | 324 // window to be shown as soon as its contents are painted for the first time. |
| 298 void Show(ShowType show_type); | 325 void Show(ShowType show_type); |
| 299 | 326 |
| 300 // Hides the window. If the window was previously flagged to be shown on | 327 // Hides the window. If the window was previously flagged to be shown on |
| 301 // first paint, it will be unflagged. | 328 // first paint, it will be unflagged. |
| 302 void Hide(); | 329 void Hide(); |
| 303 | 330 |
| 304 ShellWindowContents* shell_window_contents_for_test() { | 331 ShellWindowContents* shell_window_contents_for_test() { |
| 305 return shell_window_contents_.get(); | 332 return shell_window_contents_.get(); |
| 306 } | 333 } |
| 307 | 334 |
| 308 // Get the size constraints. | 335 // Get the size constraints. |
| 309 const SizeConstraints& size_constraints() const { | 336 const SizeConstraints& size_constraints() const { |
| 310 return size_constraints_; | 337 return size_constraints_; |
| 311 } | 338 } |
| 312 | 339 |
| 340 // Get the fullscreen type. | |
| 341 FullscreenType fullscreen_type() const { | |
| 342 return fullscreen_type_; | |
| 343 } | |
| 344 | |
| 313 protected: | 345 protected: |
| 314 virtual ~ShellWindow(); | 346 virtual ~ShellWindow(); |
| 315 | 347 |
| 316 private: | 348 private: |
| 317 // PlatformAppBrowserTest needs access to web_contents() | 349 // PlatformAppBrowserTest needs access to web_contents() |
| 318 friend class extensions::PlatformAppBrowserTest; | 350 friend class extensions::PlatformAppBrowserTest; |
| 319 | 351 |
| 320 // content::WebContentsDelegate implementation. | 352 // content::WebContentsDelegate implementation. |
| 321 virtual void CloseContents(content::WebContents* contents) OVERRIDE; | 353 virtual void CloseContents(content::WebContents* contents) OVERRIDE; |
| 322 virtual bool ShouldSuppressDialogs() OVERRIDE; | 354 virtual bool ShouldSuppressDialogs() OVERRIDE; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 | 469 |
| 438 // An object to load the app's icon as an extension resource. | 470 // An object to load the app's icon as an extension resource. |
| 439 scoped_ptr<extensions::IconImage> app_icon_image_; | 471 scoped_ptr<extensions::IconImage> app_icon_image_; |
| 440 | 472 |
| 441 scoped_ptr<NativeAppWindow> native_app_window_; | 473 scoped_ptr<NativeAppWindow> native_app_window_; |
| 442 scoped_ptr<ShellWindowContents> shell_window_contents_; | 474 scoped_ptr<ShellWindowContents> shell_window_contents_; |
| 443 scoped_ptr<Delegate> delegate_; | 475 scoped_ptr<Delegate> delegate_; |
| 444 | 476 |
| 445 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; | 477 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; |
| 446 | 478 |
| 447 // Fullscreen entered by app.window api. | 479 // The fullscreen type. |
| 448 bool fullscreen_for_window_api_; | 480 FullscreenType fullscreen_type_; |
| 449 // Fullscreen entered by HTML requestFullscreen. | |
| 450 bool fullscreen_for_tab_; | |
| 451 | 481 |
| 452 // Size constraints on the window. | 482 // Size constraints on the window. |
| 453 SizeConstraints size_constraints_; | 483 SizeConstraints size_constraints_; |
| 454 | 484 |
| 455 // Show has been called, so the window should be shown once the first visually | 485 // Show has been called, so the window should be shown once the first visually |
| 456 // non-empty paint occurs. | 486 // non-empty paint occurs. |
| 457 bool show_on_first_paint_; | 487 bool show_on_first_paint_; |
| 458 | 488 |
| 459 // The first visually non-empty paint has completed. | 489 // The first visually non-empty paint has completed. |
| 460 bool first_paint_complete_; | 490 bool first_paint_complete_; |
| 461 | 491 |
| 462 // Whether the delayed Show() call was for an active or inactive window. | 492 // Whether the delayed Show() call was for an active or inactive window. |
| 463 ShowType delayed_show_type_; | 493 ShowType delayed_show_type_; |
| 464 | 494 |
| 465 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 495 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
| 466 }; | 496 }; |
| 467 | 497 |
| 468 } // namespace apps | 498 } // namespace apps |
| 469 | 499 |
| 470 #endif // APPS_SHELL_WINDOW_H_ | 500 #endif // APPS_SHELL_WINDOW_H_ |
| OLD | NEW |