| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // idea for multi-monitor systems. Unfortunately, it appears to not work at | 31 // idea for multi-monitor systems. Unfortunately, it appears to not work at |
| 32 // least some of the time (erroneously returning NULL) and there's almost no | 32 // least some of the time (erroneously returning NULL) and there's almost no |
| 33 // online documentation or other sample code using it that suggests ways to | 33 // online documentation or other sample code using it that suggests ways to |
| 34 // address this problem. We do the following:- | 34 // address this problem. We do the following:- |
| 35 // 1. Use the ABM_GETAUTOHIDEBAR message. If it works, i.e. returns a valid | 35 // 1. Use the ABM_GETAUTOHIDEBAR message. If it works, i.e. returns a valid |
| 36 // window we are done. | 36 // window we are done. |
| 37 // 2. If the ABM_GETAUTOHIDEBAR message does not work we query the auto hide | 37 // 2. If the ABM_GETAUTOHIDEBAR message does not work we query the auto hide |
| 38 // state of the taskbar and then retrieve its position. That call returns | 38 // state of the taskbar and then retrieve its position. That call returns |
| 39 // the edge on which the taskbar is present. If it matches the edge we | 39 // the edge on which the taskbar is present. If it matches the edge we |
| 40 // are looking for, we are done. | 40 // are looking for, we are done. |
| 41 // NOTE: This call spins a nested message loop. | 41 // NOTE: This call spins a nested run loop. |
| 42 HWND taskbar = reinterpret_cast<HWND>( | 42 HWND taskbar = reinterpret_cast<HWND>( |
| 43 SHAppBarMessage(ABM_GETAUTOHIDEBAR, &taskbar_data)); | 43 SHAppBarMessage(ABM_GETAUTOHIDEBAR, &taskbar_data)); |
| 44 if (!::IsWindow(taskbar)) { | 44 if (!::IsWindow(taskbar)) { |
| 45 APPBARDATA taskbar_data = {sizeof(APPBARDATA), 0, 0, 0}; | 45 APPBARDATA taskbar_data = {sizeof(APPBARDATA), 0, 0, 0}; |
| 46 unsigned int taskbar_state = SHAppBarMessage(ABM_GETSTATE, &taskbar_data); | 46 unsigned int taskbar_state = SHAppBarMessage(ABM_GETSTATE, &taskbar_data); |
| 47 if (!(taskbar_state & ABS_AUTOHIDE)) | 47 if (!(taskbar_state & ABS_AUTOHIDE)) |
| 48 return false; | 48 return false; |
| 49 | 49 |
| 50 taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", NULL); | 50 taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", NULL); |
| 51 if (!::IsWindow(taskbar_data.hWnd)) | 51 if (!::IsWindow(taskbar_data.hWnd)) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 HMONITOR monitor, | 181 HMONITOR monitor, |
| 182 int returned_edges, | 182 int returned_edges, |
| 183 int edges) { | 183 int edges) { |
| 184 appbar_autohide_edge_map_[monitor] = edges; | 184 appbar_autohide_edge_map_[monitor] = edges; |
| 185 if (returned_edges == edges) | 185 if (returned_edges == edges) |
| 186 return; | 186 return; |
| 187 | 187 |
| 188 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); | 188 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); |
| 189 callback.Run(); | 189 callback.Run(); |
| 190 } | 190 } |
| OLD | NEW |