Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/ui/views/frame/immersive_mode_controller.h

Issue 13866026: Adds functionality to anchor widgets to the top-of-window views in immersive mode (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 59
56 // Returns a lock which will keep the top-of-window views revealed for its 60 // Returns a lock which will keep the top-of-window views revealed for its
57 // lifetime. Several locks can be obtained. When all of the locks are 61 // lifetime. Several locks can be obtained. When all of the locks are
58 // destroyed, if immersive mode is enabled and there is nothing else keeping 62 // destroyed, if immersive mode is enabled and there is nothing else keeping
59 // the top-of-window views revealed, the top-of-window views will be closed. 63 // the top-of-window views revealed, the top-of-window views will be closed.
60 // This method always returns a valid lock regardless of whether immersive 64 // This method always returns a valid lock regardless of whether immersive
61 // mode is enabled. The lock's lifetime can span immersive mode being 65 // mode is enabled. The lock's lifetime can span immersive mode being
62 // enabled / disabled. 66 // enabled / disabled.
63 // The caller takes ownership of the returned lock. 67 // The caller takes ownership of the returned lock.
64 virtual RevealedLock* GetRevealedLock() WARN_UNUSED_RESULT = 0; 68 virtual RevealedLock* GetRevealedLock() WARN_UNUSED_RESULT = 0;
69
70 // Anchor |widget| to the top-of-window views. This repositions |widget| such
71 // that it stays |y_offset| below the top-of-window views when the
72 // top-of-window views are animating (top-of-window views reveal / unreveal)
73 // or the top container's bounds change (eg the bookmark bar is shown).
74 // If the top-of-window views are revealed (or become revealed), |widget|
75 // will keep the top-of-window views revealed till either |widget| is hidden
76 // or UnanchorWidgetFromTopContainer() is called.
77 // It is legal for a widget to be anchored when immersive fullscreen is
78 // disabled, however it will have no effect till immersive fullscreen is
79 // enabled.
80 virtual void AnchorWidgetToTopContainer(views::Widget* widget,
81 int y_offset) = 0;
82
83 // Stops managing |widget|'s y position.
84 // Closes the top-of-window views if no locks or other anchored widgets are
85 // keeping the top-of-window views revealed.
86 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) = 0;
87
88 // Called by the TopContainerView to indicate that its bounds have changed.
89 virtual void OnTopContainerBoundsChanged() = 0;
65 }; 90 };
66 91
67 namespace chrome { 92 namespace chrome {
68 93
69 // Returns true if immersive mode should be used for fullscreen based on 94 // Returns true if immersive mode should be used for fullscreen based on
70 // command line flags. 95 // command line flags.
71 // Implemented in immersive_mode_controller_factory.cc. 96 // Implemented in immersive_mode_controller_factory.cc.
72 bool UseImmersiveFullscreen(); 97 bool UseImmersiveFullscreen();
73 98
74 // Implemented in immersive_mode_controller_factory.cc. 99 // Implemented in immersive_mode_controller_factory.cc.
75 ImmersiveModeController* CreateImmersiveModeController(); 100 ImmersiveModeController* CreateImmersiveModeController();
76 101
77 } // namespace chrome 102 } // namespace chrome
78 103
79 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ 104 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698