1 // Copyright (c) 2012 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_DISPLAY_SETTINGS_PROVIDER_WIN_H_ 6 #define CHROME_BROWSER_UI_PANELS_DISPLAY_SETTINGS_PROVIDER_WIN_H_ 7 8 #include "chrome/browser/ui/panels/display_settings_provider.h" 9 10 #include <windows.h> 11 #include "base/compiler_specific.h" 12 #include "base/timer/timer.h" 13 14 class DisplaySettingsProviderWin : public DisplaySettingsProvider { 15 public: 16 DisplaySettingsProviderWin(); 17 virtual ~DisplaySettingsProviderWin(); 18 19 protected: 20 // Overridden from DisplaySettingsProvider: 21 virtual void OnDisplaySettingsChanged() OVERRIDE; 22 virtual bool IsAutoHidingDesktopBarEnabled( 23 DesktopBarAlignment alignment) OVERRIDE; 24 virtual int GetDesktopBarThickness( 25 DesktopBarAlignment alignment) const OVERRIDE; 26 virtual DesktopBarVisibility GetDesktopBarVisibility( 27 DesktopBarAlignment alignment) const OVERRIDE; 28 29 int GetDesktopBarThicknessFromBounds( 30 DesktopBarAlignment alignment, const gfx::Rect& taskbar_bounds) const; 31 DesktopBarVisibility GetDesktopBarVisibilityFromBounds( 32 DesktopBarAlignment alignment, const gfx::Rect& taskbar_bounds) const; 33 34 private: 35 struct Taskbar { 36 HWND window; 37 DesktopBarVisibility visibility; 38 int thickness; 39 }; 40 41 // Callback to perform periodic check for taskbar changes. 42 void OnPollingTimer(); 43 44 // Returns true if there is at least one auto-hiding taskbar found. 45 bool CheckTaskbars(bool notify_observer); 46 47 gfx::Rect GetBounds(DesktopBarAlignment alignment) const; 48 49 // Maximum number of taskbars we're interested in: bottom, left, and right. 50 static const int kMaxTaskbars = 3; 51 52 HMONITOR monitor_; 53 Taskbar taskbars_[kMaxTaskbars]; 54 base::RepeatingTimer<DisplaySettingsProviderWin> polling_timer_; 55 56 DISALLOW_COPY_AND_ASSIGN(DisplaySettingsProviderWin); 57 }; 58 59 #endif // CHROME_BROWSER_UI_PANELS_DISPLAY_SETTINGS_PROVIDER_WIN_H_ 60