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_HIDING_DESKTOP_BAR_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_AUTO_HIDING_DESKTOP_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 auto-hiding desktop bars, |
| 16 // like Windows taskbar or MacOSX dock. |
| 17 // Note that the ref count is needed by using PostTask in the implementation of |
| 18 // MockAutoHidingDesktopBar that derives from AutoHidingDesktopBar. |
| 19 class AutoHidingDesktopBar : public base::RefCounted<AutoHidingDesktopBar> { |
| 20 public: |
| 21 // Indicates which screen edge the desktop bar is aligned to. |
| 22 // We do not care about the desktop aligned to the top screen edge. |
| 23 enum Alignment { |
| 24 ALIGN_BOTTOM = 0, |
| 25 ALIGN_LEFT = 1, |
| 26 ALIGN_RIGHT = 2 |
| 27 }; |
| 28 |
| 29 enum Visibility { |
| 30 VISIBLE, |
| 31 ANIMATING, |
| 32 HIDDEN |
| 33 }; |
| 34 |
| 35 // Observer can listen to various events regarding the desktop bar changes. |
| 36 class Observer { |
| 37 public: |
| 38 // Called when any of the desktop bars get their thickness changed. |
| 39 // Note that if an auto-hiding desktop bar is moved from one edge |
| 40 // to another edge, it will cause thickness changes to both edges. |
| 41 virtual void OnAutoHidingDesktopBarThicknessChanged() = 0; |
| 42 |
| 43 // Called when an auto-hiding desktop bar has its visibility changed. |
| 44 virtual void OnAutoHidingDesktopBarVisibilityChanged( |
| 45 Alignment alignment, Visibility visibility) = 0; |
| 46 }; |
| 47 |
| 48 static AutoHidingDesktopBar* Create(Observer* observer); |
| 49 |
| 50 virtual ~AutoHidingDesktopBar() { } |
| 51 |
| 52 // This should be called each time when the work area is changed. We only |
| 53 // care about the desktop bars that sit on the screen that hosts the specified |
| 54 // work area. |
| 55 virtual void UpdateWorkArea(const gfx::Rect& work_area) = 0; |
| 56 |
| 57 // Returns true if there is a desktop bar that is aligned to the specified |
| 58 // screen edge and set to auto-hide. |
| 59 virtual bool IsEnabled(Alignment alignment) = 0; |
| 60 |
| 61 // Returns the thickness of the desktop bar that is aligned to the specified |
| 62 // screen edge, when it is visible. When the desktop bar is aligned to bottom |
| 63 // edge, this is the height of the bar. If the desktop bar is aligned to |
| 64 // left or right edge, this is the width of the bar. |
| 65 virtual int GetThickness(Alignment alignment) const = 0; |
| 66 |
| 67 // Returns the visibility state of the desktop bar that is aligned to the |
| 68 // specified screen edge. |
| 69 virtual Visibility GetVisibility(Alignment alignment) const = 0; |
| 70 }; |
| 71 |
| 72 #endif // CHROME_BROWSER_UI_PANELS_AUTO_HIDING_DESKTOP_BAR_H_ |
OLD | NEW |