Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_PANELS_AUTO_HIDE_BOTTOM_BAR_H_ | |
| 6 #define CHROME_BROWSER_UI_PANELS_AUTO_HIDE_BOTTOM_BAR_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 | |
| 11 namespace gfx { | |
| 12 class Rect; | |
| 13 } | |
| 14 | |
| 15 // Encapsulates the logic to deal with always-on-top system/app bar that is | |
| 16 // located at the bottom of the screen and set to auto-hide, like Windows | |
|
jennb
2011/08/23 20:28:34
Just thinking ahead: this one handles bottom of s
jianli
2011/08/26 00:18:16
Refactored to handle all other edges.
| |
| 17 // taskbar or MacOSX dock. | |
| 18 // Note that the ref count is needed by using PostTask in the implementation of | |
| 19 // MockAutoHideBottomBar that derives from AutoHideBottomBar. | |
| 20 class AutoHideBottomBar : public base::RefCountedThreadSafe<AutoHideBottomBar> { | |
| 21 public: | |
| 22 enum Visibility { | |
| 23 VISIBLE, | |
| 24 ANIMATING, | |
| 25 HIDDEN | |
| 26 }; | |
| 27 | |
| 28 // Observer can listen to various events regarding the bottom bar changes. | |
| 29 class Observer { | |
| 30 public: | |
| 31 virtual void OnAutoHideBottomBarVisibilityChanged( | |
| 32 Visibility visibility) = 0; | |
| 33 virtual void OnAutoHideBottomBarHeightChanged(int height) = 0; | |
| 34 }; | |
| 35 | |
| 36 static AutoHideBottomBar* Create(Observer* observer); | |
| 37 | |
| 38 virtual ~AutoHideBottomBar() { } | |
| 39 | |
| 40 // This should be called each time when the work area is changed. We only | |
| 41 // care about the bottom bar that sits on the screen that hosts the specified | |
| 42 // work area. | |
| 43 virtual void UpdateWorkArea(const gfx::Rect& work_area) = 0; | |
| 44 | |
| 45 // Returns true if the auto-hide bottom bar is enabled. | |
| 46 virtual bool IsEnabled() = 0; | |
|
jennb
2011/08/23 20:28:34
After reading more, I realize this value does doub
jianli
2011/08/26 00:18:16
Now it takes an alignment parameter.
| |
| 47 | |
| 48 // Returns the fixed height of the bottom bar. Note that the height remains | |
| 49 // unchanged no matter whether the bottom bar is brought up or down. | |
| 50 | |
|
jennb
2011/08/23 20:28:34
Extra blank line?
jianli
2011/08/26 00:18:16
Not needed. Removed.
| |
| 51 // Returns the height of bottom bar that corresponds to Visibility VISIBLE. | |
| 52 // This value does not depend on current bar's Visibility. The visible height | |
| 53 // of the bar when it's HIDDEN is usually between 0 and a few pixels. | |
| 54 virtual int GetHeight() = 0; | |
| 55 | |
| 56 virtual Visibility GetVisibility() = 0; | |
| 57 }; | |
| 58 | |
| 59 #endif // CHROME_BROWSER_UI_PANELS_AUTO_HIDE_BOTTOM_BAR_H_ | |
| OLD | NEW |