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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 137353002: Remove GetMonitorInfoWrapper, which is no longer needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 11 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 | « ui/views/win/fullscreen_handler.cc ('k') | 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 "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <wtsapi32.h> 9 #include <wtsapi32.h>
10 #pragma comment(lib, "wtsapi32.lib") 10 #pragma comment(lib, "wtsapi32.lib")
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 gfx::Rect* monitor_rect, 179 gfx::Rect* monitor_rect,
180 gfx::Rect* work_area) { 180 gfx::Rect* work_area) {
181 DCHECK(monitor); 181 DCHECK(monitor);
182 DCHECK(monitor_rect); 182 DCHECK(monitor_rect);
183 DCHECK(work_area); 183 DCHECK(work_area);
184 *monitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONULL); 184 *monitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONULL);
185 if (!*monitor) 185 if (!*monitor)
186 return false; 186 return false;
187 MONITORINFO monitor_info = { 0 }; 187 MONITORINFO monitor_info = { 0 };
188 monitor_info.cbSize = sizeof(monitor_info); 188 monitor_info.cbSize = sizeof(monitor_info);
189 base::win::GetMonitorInfoWrapper(*monitor, &monitor_info); 189 GetMonitorInfo(*monitor, &monitor_info);
190 *monitor_rect = gfx::Rect(monitor_info.rcMonitor); 190 *monitor_rect = gfx::Rect(monitor_info.rcMonitor);
191 *work_area = gfx::Rect(monitor_info.rcWork); 191 *work_area = gfx::Rect(monitor_info.rcWork);
192 return true; 192 return true;
193 } 193 }
194 194
195 struct FindOwnedWindowsData { 195 struct FindOwnedWindowsData {
196 HWND window; 196 HWND window;
197 std::vector<Widget*> owned_widgets; 197 std::vector<Widget*> owned_widgets;
198 }; 198 };
199 199
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 // GetWindowPlacement can return misleading position if a normalized 543 // GetWindowPlacement can return misleading position if a normalized
544 // window was resized using Aero Snap feature (see comment 9 in bug 544 // window was resized using Aero Snap feature (see comment 9 in bug
545 // 36421). As a workaround, using GetWindowRect for normalized windows. 545 // 36421). As a workaround, using GetWindowRect for normalized windows.
546 const bool succeeded = GetWindowRect(hwnd(), &wp.rcNormalPosition) != 0; 546 const bool succeeded = GetWindowRect(hwnd(), &wp.rcNormalPosition) != 0;
547 DCHECK(succeeded); 547 DCHECK(succeeded);
548 548
549 *bounds = gfx::Rect(wp.rcNormalPosition); 549 *bounds = gfx::Rect(wp.rcNormalPosition);
550 } else { 550 } else {
551 MONITORINFO mi; 551 MONITORINFO mi;
552 mi.cbSize = sizeof(mi); 552 mi.cbSize = sizeof(mi);
553 const bool succeeded = base::win::GetMonitorInfoWrapper( 553 const bool succeeded = GetMonitorInfo(
554 MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST), &mi) != 0; 554 MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST), &mi) != 0;
555 DCHECK(succeeded); 555 DCHECK(succeeded);
556 556
557 *bounds = gfx::Rect(wp.rcNormalPosition); 557 *bounds = gfx::Rect(wp.rcNormalPosition);
558 // Convert normal position from workarea coordinates to screen 558 // Convert normal position from workarea coordinates to screen
559 // coordinates. 559 // coordinates.
560 bounds->Offset(mi.rcWork.left - mi.rcMonitor.left, 560 bounds->Offset(mi.rcWork.left - mi.rcMonitor.left,
561 mi.rcWork.top - mi.rcMonitor.top); 561 mi.rcWork.top - mi.rcMonitor.top);
562 } 562 }
563 } 563 }
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 CRect window_rect; 1161 CRect window_rect;
1162 GetWindowRect(hwnd(), &window_rect); 1162 GetWindowRect(hwnd(), &window_rect);
1163 HRGN new_region; 1163 HRGN new_region;
1164 if (custom_window_region_) { 1164 if (custom_window_region_) {
1165 new_region = ::CreateRectRgn(0, 0, 0, 0); 1165 new_region = ::CreateRectRgn(0, 0, 0, 0);
1166 ::CombineRgn(new_region, custom_window_region_.Get(), NULL, RGN_COPY); 1166 ::CombineRgn(new_region, custom_window_region_.Get(), NULL, RGN_COPY);
1167 } else if (IsMaximized()) { 1167 } else if (IsMaximized()) {
1168 HMONITOR monitor = MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST); 1168 HMONITOR monitor = MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST);
1169 MONITORINFO mi; 1169 MONITORINFO mi;
1170 mi.cbSize = sizeof mi; 1170 mi.cbSize = sizeof mi;
1171 base::win::GetMonitorInfoWrapper(monitor, &mi); 1171 GetMonitorInfo(monitor, &mi);
1172 CRect work_rect = mi.rcWork; 1172 CRect work_rect = mi.rcWork;
1173 work_rect.OffsetRect(-window_rect.left, -window_rect.top); 1173 work_rect.OffsetRect(-window_rect.left, -window_rect.top);
1174 new_region = CreateRectRgnIndirect(&work_rect); 1174 new_region = CreateRectRgnIndirect(&work_rect);
1175 } else { 1175 } else {
1176 gfx::Path window_mask; 1176 gfx::Path window_mask;
1177 delegate_->GetWindowMask( 1177 delegate_->GetWindowMask(
1178 gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); 1178 gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask);
1179 new_region = gfx::CreateHRGNFromSkPath(window_mask); 1179 new_region = gfx::CreateHRGNFromSkPath(window_mask);
1180 } 1180 }
1181 1181
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 SetMsgHandled(FALSE); 2388 SetMsgHandled(FALSE);
2389 } 2389 }
2390 2390
2391 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { 2391 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) {
2392 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 2392 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
2393 for (size_t i = 0; i < touch_events.size() && ref; ++i) 2393 for (size_t i = 0; i < touch_events.size() && ref; ++i)
2394 delegate_->HandleTouchEvent(touch_events[i]); 2394 delegate_->HandleTouchEvent(touch_events[i]);
2395 } 2395 }
2396 2396
2397 } // namespace views 2397 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/win/fullscreen_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698