OLD | NEW |
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/public/browser/browser_accessibility_state.h" | 12 #include "content/public/browser/browser_accessibility_state.h" |
13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
14 #include "ui/base/touch/touch_enabled.h" | 14 #include "ui/base/touch/touch_enabled.h" |
15 #include "ui/base/view_prop.h" | 15 #include "ui/base/view_prop.h" |
16 #include "ui/base/win/internal_constants.h" | 16 #include "ui/base/win/internal_constants.h" |
17 #include "ui/base/win/window_event_target.h" | 17 #include "ui/base/win/window_event_target.h" |
18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 19 #include "ui/gfx/win/dpi.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 // A custom MSAA object id used to determine if a screen reader or some | 23 // A custom MSAA object id used to determine if a screen reader or some |
23 // other client is listening on MSAA events - if so, we enable full web | 24 // other client is listening on MSAA events - if so, we enable full web |
24 // accessibility support. | 25 // accessibility support. |
25 const int kIdScreenReaderHoneyPot = 1; | 26 const int kIdScreenReaderHoneyPot = 1; |
26 | 27 |
27 LegacyRenderWidgetHostHWND::~LegacyRenderWidgetHostHWND() { | 28 LegacyRenderWidgetHostHWND::~LegacyRenderWidgetHostHWND() { |
28 ::DestroyWindow(hwnd()); | 29 ::DestroyWindow(hwnd()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 73 |
73 void LegacyRenderWidgetHostHWND::Show() { | 74 void LegacyRenderWidgetHostHWND::Show() { |
74 ::ShowWindow(hwnd(), SW_SHOW); | 75 ::ShowWindow(hwnd(), SW_SHOW); |
75 } | 76 } |
76 | 77 |
77 void LegacyRenderWidgetHostHWND::Hide() { | 78 void LegacyRenderWidgetHostHWND::Hide() { |
78 ::ShowWindow(hwnd(), SW_HIDE); | 79 ::ShowWindow(hwnd(), SW_HIDE); |
79 } | 80 } |
80 | 81 |
81 void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) { | 82 void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) { |
82 ::SetWindowPos(hwnd(), NULL, bounds.x(), bounds.y(), bounds.width(), | 83 gfx::Rect bounds_in_pixel = gfx::win::DIPToScreenRect(bounds); |
83 bounds.height(), 0); | 84 ::SetWindowPos(hwnd(), NULL, bounds_in_pixel.x(), bounds_in_pixel.y(), |
| 85 bounds_in_pixel.width(), bounds_in_pixel.height(), 0); |
84 } | 86 } |
85 | 87 |
86 void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { | 88 void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { |
87 if (manager_) | 89 if (manager_) |
88 manager_->OnAccessibleHwndDeleted(); | 90 manager_->OnAccessibleHwndDeleted(); |
89 } | 91 } |
90 | 92 |
91 LegacyRenderWidgetHostHWND::LegacyRenderWidgetHostHWND(HWND parent) | 93 LegacyRenderWidgetHostHWND::LegacyRenderWidgetHostHWND(HWND parent) |
92 : manager_(NULL), | 94 : manager_(NULL), |
93 mouse_tracking_enabled_(false) { | 95 mouse_tracking_enabled_(false) { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // generate the legacy WM_VSCROLL/WM_HSCROLL messages. | 320 // generate the legacy WM_VSCROLL/WM_HSCROLL messages. |
319 // We add these styles to ensure that trackpad/trackpoint scrolling | 321 // We add these styles to ensure that trackpad/trackpoint scrolling |
320 // work. | 322 // work. |
321 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); | 323 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); |
322 ::SetWindowLong(hwnd(), GWL_STYLE, | 324 ::SetWindowLong(hwnd(), GWL_STYLE, |
323 current_style | WS_VSCROLL | WS_HSCROLL); | 325 current_style | WS_VSCROLL | WS_HSCROLL); |
324 return 0; | 326 return 0; |
325 } | 327 } |
326 | 328 |
327 } // namespace content | 329 } // namespace content |
OLD | NEW |