Chromium Code Reviews| Index: chrome/browser/ui/panels/bottom_bar_win.cc |
| =================================================================== |
| --- chrome/browser/ui/panels/bottom_bar_win.cc (revision 0) |
| +++ chrome/browser/ui/panels/bottom_bar_win.cc (revision 0) |
| @@ -0,0 +1,61 @@ |
| +// Copyright (c) 2011 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. |
| + |
| +#include "chrome/browser/ui/panels/bottom_bar.h" |
| + |
| +#include <windows.h> |
| +#include <shellapi.h> |
| + |
| +#include "base/logging.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/ui/window_sizer.h" |
| +#include "views/widget/monitor_win.h" |
| + |
| +namespace { |
| + |
| +// 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.
|
| +const int kAutoHideTaskbarThicknessPx = 2; |
| + |
| +gfx::Rect GetBottomBarBounds() { |
| + HWND taskbar = ::FindWindow(L"Shell_TrayWnd", NULL); |
| + if (!taskbar) |
| + return gfx::Rect(); |
| + RECT rect; |
| + if (!::GetWindowRect(taskbar, &rect)) |
| + return gfx::Rect(); |
| + return gfx::Rect(rect); |
| +} |
| + |
| +} |
| + |
| +bool IsBottomBarInAutoHideMode() { |
| + RECT rect; |
| + HMONITOR monitor = ::MonitorFromRect(&rect, MONITOR_DEFAULTTOPRIMARY); |
| + DCHECK(monitor); |
| + return views::EdgeHasTopmostAutoHideTaskbar(ABE_BOTTOM, monitor); |
| +} |
| + |
| +int GetBottomBarHeight() { |
| + gfx::Rect bounds = GetBottomBarBounds(); |
| + return bounds.height(); |
| +} |
| + |
| +bool IsBottomBarFullyVisible() { |
| + scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider( |
| + WindowSizer::CreateDefaultMonitorInfoProvider()); |
| + gfx::Rect screen_bounds = info_provider->GetPrimaryMonitorBounds(); |
| + |
| + gfx::Rect bottom_bar_bounds = GetBottomBarBounds(); |
| + return bottom_bar_bounds.bottom() <= screen_bounds.bottom(); |
| +} |
| + |
| +bool IsBottomBarHidden() { |
| + scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider( |
| + WindowSizer::CreateDefaultMonitorInfoProvider()); |
| + gfx::Rect screen_bounds = info_provider->GetPrimaryMonitorBounds(); |
| + |
| + gfx::Rect bottom_bar_bounds = GetBottomBarBounds(); |
| + return bottom_bar_bounds.y() >= |
| + screen_bounds.bottom() - kAutoHideTaskbarThicknessPx; |
| +} |
| Property changes on: chrome\browser\ui\panels\bottom_bar_win.cc |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |