Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: chrome/browser/ui/panels/bottom_bar_win.cc

Issue 7646003: Support auto-hide taskbar for panels on Windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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 #include "chrome/browser/ui/panels/bottom_bar.h"
6
7 #include <windows.h>
8 #include <shellapi.h>
9
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/window_sizer.h"
13 #include "views/widget/monitor_win.h"
14
15 namespace {
16
17 // The thickness of an auto-hide taskbar in pixels.
Dmitry Titov 2011/08/17 22:56:38 What is exactly a thickness here? Needs better exp
jianli 2011/08/22 20:44:42 Done.
18 const int kAutoHideTaskbarThicknessPx = 2;
19
20 gfx::Rect GetBottomBarBounds() {
21 HWND taskbar = ::FindWindow(L"Shell_TrayWnd", NULL);
22 if (!taskbar)
23 return gfx::Rect();
24 RECT rect;
25 if (!::GetWindowRect(taskbar, &rect))
26 return gfx::Rect();
27 return gfx::Rect(rect);
28 }
29
30 }
31
32 bool IsBottomBarInAutoHideMode() {
33 RECT rect;
34 HMONITOR monitor = ::MonitorFromRect(&rect, MONITOR_DEFAULTTOPRIMARY);
35 DCHECK(monitor);
36 return views::EdgeHasTopmostAutoHideTaskbar(ABE_BOTTOM, monitor);
37 }
38
39 int GetBottomBarHeight() {
40 gfx::Rect bounds = GetBottomBarBounds();
41 return bounds.height();
42 }
43
44 bool IsBottomBarFullyVisible() {
45 scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider(
46 WindowSizer::CreateDefaultMonitorInfoProvider());
47 gfx::Rect screen_bounds = info_provider->GetPrimaryMonitorBounds();
48
49 gfx::Rect bottom_bar_bounds = GetBottomBarBounds();
50 return bottom_bar_bounds.bottom() <= screen_bounds.bottom();
51 }
52
53 bool IsBottomBarHidden() {
54 scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider(
55 WindowSizer::CreateDefaultMonitorInfoProvider());
56 gfx::Rect screen_bounds = info_provider->GetPrimaryMonitorBounds();
57
58 gfx::Rect bottom_bar_bounds = GetBottomBarBounds();
59 return bottom_bar_bounds.y() >=
60 screen_bounds.bottom() - kAutoHideTaskbarThicknessPx;
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698