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

Side by Side Diff: content/browser/renderer_host/legacy_render_widget_host_win.cc

Issue 1426933002: Refactor Windows DPI Point, Rect, and Size for Multiple Monitor DPI Awareness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Other Unit Tests - Moved Inner Classes Outside Created 4 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "content/browser/renderer_host/legacy_render_widget_host_win.h" 5 #include "content/browser/renderer_host/legacy_render_widget_host_win.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 10 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
11 #include "content/browser/accessibility/browser_accessibility_win.h" 11 #include "content/browser/accessibility/browser_accessibility_win.h"
12 #include "content/browser/renderer_host/render_widget_host_impl.h" 12 #include "content/browser/renderer_host/render_widget_host_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 13 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
14 #include "content/public/browser/browser_accessibility_state.h" 14 #include "content/public/browser/browser_accessibility_state.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 #include "ui/base/touch/touch_enabled.h" 16 #include "ui/base/touch/touch_enabled.h"
17 #include "ui/base/view_prop.h" 17 #include "ui/base/view_prop.h"
18 #include "ui/base/win/internal_constants.h" 18 #include "ui/base/win/internal_constants.h"
19 #include "ui/base/win/window_event_target.h" 19 #include "ui/base/win/window_event_target.h"
20 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
21 #include "ui/gfx/screen_win.h"
21 #include "ui/gfx/win/direct_manipulation.h" 22 #include "ui/gfx/win/direct_manipulation.h"
22 #include "ui/gfx/win/dpi.h"
23 23
24 namespace content { 24 namespace content {
25 25
26 // A custom MSAA object id used to determine if a screen reader or some 26 // A custom MSAA object id used to determine if a screen reader or some
27 // other client is listening on MSAA events - if so, we enable full web 27 // other client is listening on MSAA events - if so, we enable full web
28 // accessibility support. 28 // accessibility support.
29 const int kIdScreenReaderHoneyPot = 1; 29 const int kIdScreenReaderHoneyPot = 1;
30 30
31 // static 31 // static
32 LegacyRenderWidgetHostHWND* LegacyRenderWidgetHostHWND::Create( 32 LegacyRenderWidgetHostHWND* LegacyRenderWidgetHostHWND::Create(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void LegacyRenderWidgetHostHWND::Show() { 77 void LegacyRenderWidgetHostHWND::Show() {
78 ::ShowWindow(hwnd(), SW_SHOW); 78 ::ShowWindow(hwnd(), SW_SHOW);
79 } 79 }
80 80
81 void LegacyRenderWidgetHostHWND::Hide() { 81 void LegacyRenderWidgetHostHWND::Hide() {
82 ::ShowWindow(hwnd(), SW_HIDE); 82 ::ShowWindow(hwnd(), SW_HIDE);
83 } 83 }
84 84
85 void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) { 85 void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) {
86 gfx::Rect bounds_in_pixel = gfx::win::DIPToScreenRect(bounds); 86 gfx::Rect bounds_in_pixel = gfx::ScreenWin::DIPToClientRect(hwnd(), bounds);
87 ::SetWindowPos(hwnd(), NULL, bounds_in_pixel.x(), bounds_in_pixel.y(), 87 ::SetWindowPos(hwnd(), NULL, bounds_in_pixel.x(), bounds_in_pixel.y(),
88 bounds_in_pixel.width(), bounds_in_pixel.height(), 88 bounds_in_pixel.width(), bounds_in_pixel.height(),
89 SWP_NOREDRAW); 89 SWP_NOREDRAW);
90 if (direct_manipulation_helper_) 90 if (direct_manipulation_helper_)
91 direct_manipulation_helper_->SetBounds(bounds_in_pixel); 91 direct_manipulation_helper_->SetBounds(bounds_in_pixel);
92 } 92 }
93 93
94 void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { 94 void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) {
95 if (host_) { 95 if (host_) {
96 host_->OnLegacyWindowDestroyed(); 96 host_->OnLegacyWindowDestroyed();
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 direct_manipulation_helper_->Activate(hwnd()); 404 direct_manipulation_helper_->Activate(hwnd());
405 } else if (window_pos->flags & SWP_HIDEWINDOW) { 405 } else if (window_pos->flags & SWP_HIDEWINDOW) {
406 direct_manipulation_helper_->Deactivate(hwnd()); 406 direct_manipulation_helper_->Deactivate(hwnd());
407 } 407 }
408 } 408 }
409 SetMsgHandled(FALSE); 409 SetMsgHandled(FALSE);
410 return 0; 410 return 0;
411 } 411 }
412 412
413 } // namespace content 413 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698