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_WIN_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_AUTO_HIDING_DESKTOP_BAR_WIN_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "chrome/browser/ui/panels/auto_hiding_desktop_bar.h" |
| 10 |
| 11 #include <windows.h> |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/timer.h" |
| 14 #include "ui/gfx/rect.h" |
| 15 |
| 16 class AutoHidingDesktopBarWin : public AutoHidingDesktopBar { |
| 17 public: |
| 18 explicit AutoHidingDesktopBarWin(Observer* observer); |
| 19 virtual ~AutoHidingDesktopBarWin(); |
| 20 |
| 21 // Overridden from AutoHidingDesktopBar: |
| 22 virtual void UpdateWorkArea(const gfx::Rect& work_area) OVERRIDE; |
| 23 virtual bool IsEnabled(Alignment alignment) OVERRIDE; |
| 24 virtual int GetThickness(Alignment alignment) const OVERRIDE; |
| 25 virtual Visibility GetVisibility(Alignment alignment) const OVERRIDE; |
| 26 |
| 27 #ifdef UNIT_TEST |
| 28 void set_work_area(const gfx::Rect& work_area) { |
| 29 work_area_ = work_area; |
| 30 } |
| 31 #endif |
| 32 |
| 33 private: |
| 34 friend class AutoHidingDesktopBarWinTest; |
| 35 |
| 36 struct Taskbar { |
| 37 HWND window; |
| 38 AutoHidingDesktopBar::Visibility visibility; |
| 39 int thickness; |
| 40 }; |
| 41 |
| 42 // Callback to perform periodic check for taskbar changes. |
| 43 void OnPollingTimer(); |
| 44 |
| 45 // Returns true if there is at least one auto-hiding taskbar found. |
| 46 bool CheckTaskbars(bool notify_observer); |
| 47 |
| 48 gfx::Rect GetBounds(Alignment alignment) const; |
| 49 int GetThicknessFromBounds( |
| 50 Alignment alignment, const gfx::Rect& taskbar_bounds) const; |
| 51 Visibility GetVisibilityFromBounds( |
| 52 Alignment alignment, const gfx::Rect& taskbar_bounds) const; |
| 53 |
| 54 // Maximum number of taskbars we're interested in: bottom, left, and right. |
| 55 static const int kMaxTaskbars = 3; |
| 56 |
| 57 Observer* observer_; |
| 58 gfx::Rect work_area_; |
| 59 HMONITOR monitor_; |
| 60 Taskbar taskbars_[kMaxTaskbars]; |
| 61 base::RepeatingTimer<AutoHidingDesktopBarWin> polling_timer_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AutoHidingDesktopBarWin); |
| 64 }; |
| 65 |
| 66 #endif // CHROME_BROWSER_UI_PANELS_AUTO_HIDING_DESKTOP_BAR_WIN_H_ |
OLD | NEW |