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

Unified 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698