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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 302113002: Revert use of ABM_GETAUTOHIDEBAREX since apparently it doesn't work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 PrefService* GetPrefsForWindow(const views::Widget* window) { 77 PrefService* GetPrefsForWindow(const views::Widget* window) {
78 Profile* profile = GetProfileForWindow(window); 78 Profile* profile = GetProfileForWindow(window);
79 if (!profile) { 79 if (!profile) {
80 // Use local state for windows that have no explicit profile. 80 // Use local state for windows that have no explicit profile.
81 return g_browser_process->local_state(); 81 return g_browser_process->local_state();
82 } 82 }
83 return profile->GetPrefs(); 83 return profile->GetPrefs();
84 } 84 }
85 85
86 #if defined(OS_WIN) 86 #if defined(OS_WIN)
87 bool MonitorHasTopmostAutohideTaskbarForEdge(UINT edge, const RECT& rect) { 87 bool MonitorHasTopmostAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
88 APPBARDATA taskbar_data = { sizeof(APPBARDATA), NULL, 0, edge, rect }; 88 APPBARDATA taskbar_data = { sizeof(APPBARDATA), NULL, 0, edge };
89 // MSDN documents an ABM_GETAUTOHIDEBAREX, which supposedly takes a monitor
90 // rect and returns autohide bars on that monitor. This sounds like a good
91 // idea for multi-monitor systems. Unfortunately, it appears to not work at
92 // least some of the time (erroneously returning NULL) and there's almost no
93 // online documentation or other sample code using it that suggests ways to
94 // address this problem. So we just use ABM_GETAUTOHIDEBAR and hope the user
95 // only cares about autohide bars on the monitor with the primary taskbar.
96 //
89 // NOTE: This call spins a nested message loop. 97 // NOTE: This call spins a nested message loop.
90 HWND taskbar = reinterpret_cast<HWND>(SHAppBarMessage(ABM_GETAUTOHIDEBAREX, 98 HWND taskbar = reinterpret_cast<HWND>(SHAppBarMessage(ABM_GETAUTOHIDEBAR,
91 &taskbar_data)); 99 &taskbar_data));
92 return ::IsWindow(taskbar) && 100 return ::IsWindow(taskbar) &&
101 (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONULL) == monitor) &&
93 (GetWindowLong(taskbar, GWL_EXSTYLE) & WS_EX_TOPMOST); 102 (GetWindowLong(taskbar, GWL_EXSTYLE) & WS_EX_TOPMOST);
94 } 103 }
95 104
96 int GetAppbarAutohideEdgesOnWorkerThread(HMONITOR monitor) { 105 int GetAppbarAutohideEdgesOnWorkerThread(HMONITOR monitor) {
97 DCHECK(monitor); 106 DCHECK(monitor);
98 107
99 MONITORINFO mi = { sizeof(MONITORINFO) };
100 GetMonitorInfo(monitor, &mi);
101
102 int edges = 0; 108 int edges = 0;
103 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_LEFT, mi.rcMonitor)) 109 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_LEFT, monitor))
104 edges |= views::ViewsDelegate::EDGE_LEFT; 110 edges |= views::ViewsDelegate::EDGE_LEFT;
105 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_TOP, mi.rcMonitor)) 111 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_TOP, monitor))
106 edges |= views::ViewsDelegate::EDGE_TOP; 112 edges |= views::ViewsDelegate::EDGE_TOP;
107 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_RIGHT, mi.rcMonitor)) 113 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_RIGHT, monitor))
108 edges |= views::ViewsDelegate::EDGE_RIGHT; 114 edges |= views::ViewsDelegate::EDGE_RIGHT;
109 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_BOTTOM, mi.rcMonitor)) 115 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_BOTTOM, monitor))
110 edges |= views::ViewsDelegate::EDGE_BOTTOM; 116 edges |= views::ViewsDelegate::EDGE_BOTTOM;
111 return edges; 117 return edges;
112 } 118 }
113 #endif 119 #endif
114 120
115 } // namespace 121 } // namespace
116 122
117 123
118 // ChromeViewsDelegate -------------------------------------------------------- 124 // ChromeViewsDelegate --------------------------------------------------------
119 125
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 425 }
420 #endif 426 #endif
421 427
422 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) 428 #if !defined(USE_AURA) && !defined(USE_CHROMEOS)
423 views::Widget::InitParams::WindowOpacity 429 views::Widget::InitParams::WindowOpacity
424 ChromeViewsDelegate::GetOpacityForInitParams( 430 ChromeViewsDelegate::GetOpacityForInitParams(
425 const views::Widget::InitParams& params) { 431 const views::Widget::InitParams& params) {
426 return views::Widget::InitParams::OPAQUE_WINDOW; 432 return views::Widget::InitParams::OPAQUE_WINDOW;
427 } 433 }
428 #endif 434 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698