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