OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 | 9 |
10 class BrowserView; | 10 class BrowserView; |
11 | 11 |
| 12 namespace views { |
| 13 class Widget; |
| 14 } |
| 15 |
12 // Controller for an "immersive mode" similar to MacOS presentation mode where | 16 // Controller for an "immersive mode" similar to MacOS presentation mode where |
13 // the top-of-window views are hidden until the mouse hits the top of the | 17 // the top-of-window views are hidden until the mouse hits the top of the |
14 // screen. The tab strip is optionally painted with miniature "tab indicator" | 18 // screen. The tab strip is optionally painted with miniature "tab indicator" |
15 // rectangles. | 19 // rectangles. |
16 // Currently, immersive mode is only available for Chrome OS. | 20 // Currently, immersive mode is only available for Chrome OS. |
17 class ImmersiveModeController { | 21 class ImmersiveModeController { |
18 public: | 22 public: |
19 // Base class for a lock which keeps the top-of-window views revealed for the | 23 // Base class for a lock which keeps the top-of-window views revealed for the |
20 // duration of its lifetime. See GetRevealedLock() for more details. | 24 // duration of its lifetime. See GetRevealedLock() for more details. |
21 class RevealedLock { | 25 class RevealedLock { |
(...skipping 26 matching lines...) Expand all Loading... |
48 | 52 |
49 // Returns a lock which will keep the top-of-window views revealed for its | 53 // Returns a lock which will keep the top-of-window views revealed for its |
50 // lifetime. Several locks can be obtained. When all of the locks are | 54 // lifetime. Several locks can be obtained. When all of the locks are |
51 // destroyed, if immersive mode is enabled and there is nothing else keeping | 55 // destroyed, if immersive mode is enabled and there is nothing else keeping |
52 // the top-of-window views revealed, the top-of-window views will be closed. | 56 // the top-of-window views revealed, the top-of-window views will be closed. |
53 // This method always returns a valid lock regardless of whether immersive | 57 // This method always returns a valid lock regardless of whether immersive |
54 // mode is enabled. The lock's lifetime can span immersive mode being | 58 // mode is enabled. The lock's lifetime can span immersive mode being |
55 // enabled / disabled. | 59 // enabled / disabled. |
56 // The caller takes ownership of the returned lock. | 60 // The caller takes ownership of the returned lock. |
57 virtual RevealedLock* GetRevealedLock() WARN_UNUSED_RESULT = 0; | 61 virtual RevealedLock* GetRevealedLock() WARN_UNUSED_RESULT = 0; |
| 62 |
| 63 // Anchor |widget| to the top-of-window views. This repositions |widget| such |
| 64 // that it stays |y_offset| below the top-of-window views when the |
| 65 // top-of-window views are animating (top-of-window views reveal / unreveal) |
| 66 // or the top container's bounds change (eg the bookmark bar is shown). |
| 67 // If the top-of-window views are revealed (or become revealed), |widget| |
| 68 // will keep the top-of-window views revealed till either |widget| is hidden |
| 69 // or UnanchorWidgetFromTopContainer() is called. |
| 70 // It is legal for a widget to be anchored when immersive fullscreen is |
| 71 // disabled, however it will have no effect till immersive fullscreen is |
| 72 // enabled. |
| 73 virtual void AnchorWidgetToTopContainer(views::Widget* widget, |
| 74 int y_offset) = 0; |
| 75 |
| 76 // Stops managing |widget|'s y position. |
| 77 // Closes the top-of-window views if no locks or other anchored widgets are |
| 78 // keeping the top-of-window views revealed. |
| 79 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) = 0; |
| 80 |
| 81 // Called by the TopContainerView to indicate that its bounds have changed. |
| 82 virtual void OnTopContainerBoundsChanged() = 0; |
58 }; | 83 }; |
59 | 84 |
60 namespace chrome { | 85 namespace chrome { |
61 | 86 |
62 // Returns true if immersive mode should be used for fullscreen based on | 87 // Returns true if immersive mode should be used for fullscreen based on |
63 // command line flags. | 88 // command line flags. |
64 // Implemented in immersive_mode_controller_factory.cc. | 89 // Implemented in immersive_mode_controller_factory.cc. |
65 bool UseImmersiveFullscreen(); | 90 bool UseImmersiveFullscreen(); |
66 | 91 |
67 // Implemented in immersive_mode_controller_factory.cc. | 92 // Implemented in immersive_mode_controller_factory.cc. |
68 ImmersiveModeController* CreateImmersiveModeController(); | 93 ImmersiveModeController* CreateImmersiveModeController(); |
69 | 94 |
70 } // namespace chrome | 95 } // namespace chrome |
71 | 96 |
72 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ | 97 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ |
OLD | NEW |