OLD | NEW |
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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #include "ui/wm/public/window_types.h" | 96 #include "ui/wm/public/window_types.h" |
97 | 97 |
98 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
99 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 99 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
100 #include "content/browser/accessibility/browser_accessibility_win.h" | 100 #include "content/browser/accessibility/browser_accessibility_win.h" |
101 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 101 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
102 #include "content/common/plugin_constants_win.h" | 102 #include "content/common/plugin_constants_win.h" |
103 #include "ui/base/win/hidden_window.h" | 103 #include "ui/base/win/hidden_window.h" |
104 #include "ui/gfx/gdi_util.h" | 104 #include "ui/gfx/gdi_util.h" |
105 #include "ui/gfx/screen_win.h" | 105 #include "ui/gfx/screen_win.h" |
106 #include "ui/gfx/win/dpi.h" | |
107 #endif | 106 #endif |
108 | 107 |
109 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 108 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
110 #include "content/common/input_messages.h" | 109 #include "content/common/input_messages.h" |
111 #include "ui/events/linux/text_edit_command_auralinux.h" | 110 #include "ui/events/linux/text_edit_command_auralinux.h" |
112 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" | 111 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" |
113 #endif | 112 #endif |
114 | 113 |
115 using gfx::RectToSkIRect; | 114 using gfx::RectToSkIRect; |
116 using gfx::SkIRectToRect; | 115 using gfx::SkIRectToRect; |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 params.widget = this; | 1186 params.widget = this; |
1188 params.cutout_rects = constrained_rects_; | 1187 params.cutout_rects = constrained_rects_; |
1189 params.geometry = &plugin_window_moves_; | 1188 params.geometry = &plugin_window_moves_; |
1190 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); | 1189 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); |
1191 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 1190 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
1192 } | 1191 } |
1193 | 1192 |
1194 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 1193 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
1195 // Clip the cursor if chrome is running on regular desktop. | 1194 // Clip the cursor if chrome is running on regular desktop. |
1196 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { | 1195 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { |
1197 RECT window_rect = | 1196 RECT window_rect = gfx::ScreenWin::DIPToScreenRect( |
1198 gfx::win::DIPToScreenRect(window_->GetBoundsInScreen()).ToRECT(); | 1197 window_->GetHost()->GetAcceleratedWidget(), |
| 1198 window_->GetBoundsInScreen()).ToRECT(); |
1199 ::ClipCursor(&window_rect); | 1199 ::ClipCursor(&window_rect); |
1200 } | 1200 } |
1201 } | 1201 } |
1202 | 1202 |
1203 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 1203 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
1204 legacy_render_widget_host_HWND_ = NULL; | 1204 legacy_render_widget_host_HWND_ = NULL; |
1205 legacy_window_destroyed_ = true; | 1205 legacy_window_destroyed_ = true; |
1206 } | 1206 } |
1207 #endif | 1207 #endif |
1208 | 1208 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 } | 1267 } |
1268 | 1268 |
1269 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1269 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
1270 aura::Window* top_level = window_->GetToplevelWindow(); | 1270 aura::Window* top_level = window_->GetToplevelWindow(); |
1271 gfx::Rect bounds(top_level->GetBoundsInScreen()); | 1271 gfx::Rect bounds(top_level->GetBoundsInScreen()); |
1272 | 1272 |
1273 #if defined(OS_WIN) | 1273 #if defined(OS_WIN) |
1274 // TODO(zturner,iyengar): This will break when we remove support for NPAPI and | 1274 // TODO(zturner,iyengar): This will break when we remove support for NPAPI and |
1275 // remove the legacy hwnd, so a better fix will need to be decided when that | 1275 // remove the legacy hwnd, so a better fix will need to be decided when that |
1276 // happens. | 1276 // happens. |
| 1277 aura::WindowTreeHost* host = top_level->GetHost(); |
1277 if (UsesNativeWindowFrame()) { | 1278 if (UsesNativeWindowFrame()) { |
1278 // aura::Window doesn't take into account non-client area of native windows | 1279 // aura::Window doesn't take into account non-client area of native windows |
1279 // (e.g. HWNDs), so for that case ask Windows directly what the bounds are. | 1280 // (e.g. HWNDs), so for that case ask Windows directly what the bounds are. |
1280 aura::WindowTreeHost* host = top_level->GetHost(); | |
1281 if (!host) | 1281 if (!host) |
1282 return top_level->GetBoundsInScreen(); | 1282 return top_level->GetBoundsInScreen(); |
1283 RECT window_rect = {0}; | 1283 RECT window_rect = {0}; |
1284 HWND hwnd = host->GetAcceleratedWidget(); | 1284 HWND hwnd = host->GetAcceleratedWidget(); |
1285 ::GetWindowRect(hwnd, &window_rect); | 1285 ::GetWindowRect(hwnd, &window_rect); |
1286 bounds = gfx::Rect(window_rect); | 1286 bounds = gfx::Rect(window_rect); |
1287 | 1287 |
1288 // Maximized windows are outdented from the work area by the frame thickness | 1288 // Maximized windows are outdented from the work area by the frame thickness |
1289 // even though this "frame" is not painted. This confuses code (and people) | 1289 // even though this "frame" is not painted. This confuses code (and people) |
1290 // that think of a maximized window as corresponding exactly to the work | 1290 // that think of a maximized window as corresponding exactly to the work |
1291 // area. Correct for this by subtracting the frame thickness back off. | 1291 // area. Correct for this by subtracting the frame thickness back off. |
1292 if (::IsZoomed(hwnd)) { | 1292 if (::IsZoomed(hwnd)) { |
1293 bounds.Inset(GetSystemMetrics(SM_CXSIZEFRAME), | 1293 bounds.Inset(GetSystemMetrics(SM_CXSIZEFRAME), |
1294 GetSystemMetrics(SM_CYSIZEFRAME)); | 1294 GetSystemMetrics(SM_CYSIZEFRAME)); |
1295 | 1295 |
1296 bounds.Inset(GetSystemMetrics(SM_CXPADDEDBORDER), | 1296 bounds.Inset(GetSystemMetrics(SM_CXPADDEDBORDER), |
1297 GetSystemMetrics(SM_CXPADDEDBORDER)); | 1297 GetSystemMetrics(SM_CXPADDEDBORDER)); |
1298 } | 1298 } |
1299 } | 1299 } |
1300 | 1300 |
1301 bounds = gfx::win::ScreenToDIPRect(bounds); | 1301 bounds = gfx::ScreenWin::ScreenToDIPRect( |
| 1302 host ? host->GetAcceleratedWidget() : nullptr, bounds); |
1302 #endif | 1303 #endif |
1303 | 1304 |
1304 return bounds; | 1305 return bounds; |
1305 } | 1306 } |
1306 | 1307 |
1307 void RenderWidgetHostViewAura::WheelEventAck( | 1308 void RenderWidgetHostViewAura::WheelEventAck( |
1308 const blink::WebMouseWheelEvent& event, | 1309 const blink::WebMouseWheelEvent& event, |
1309 InputEventAckState ack_result) { | 1310 InputEventAckState ack_result) { |
1310 if (overscroll_controller_) { | 1311 if (overscroll_controller_) { |
1311 overscroll_controller_->ReceivedEventACK( | 1312 overscroll_controller_->ReceivedEventACK( |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 | 3032 |
3032 //////////////////////////////////////////////////////////////////////////////// | 3033 //////////////////////////////////////////////////////////////////////////////// |
3033 // RenderWidgetHostViewBase, public: | 3034 // RenderWidgetHostViewBase, public: |
3034 | 3035 |
3035 // static | 3036 // static |
3036 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 3037 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
3037 GetScreenInfoForWindow(results, NULL); | 3038 GetScreenInfoForWindow(results, NULL); |
3038 } | 3039 } |
3039 | 3040 |
3040 } // namespace content | 3041 } // namespace content |
OLD | NEW |