Chromium Code Reviews| 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 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 #include "ui/wm/public/transient_window_client.h" | 91 #include "ui/wm/public/transient_window_client.h" |
| 92 #include "ui/wm/public/window_types.h" | 92 #include "ui/wm/public/window_types.h" |
| 93 | 93 |
| 94 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
| 95 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 95 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 96 #include "content/browser/accessibility/browser_accessibility_win.h" | 96 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 97 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 97 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
| 98 #include "content/common/plugin_constants_win.h" | 98 #include "content/common/plugin_constants_win.h" |
| 99 #include "ui/base/win/hidden_window.h" | 99 #include "ui/base/win/hidden_window.h" |
| 100 #include "ui/gfx/gdi_util.h" | 100 #include "ui/gfx/gdi_util.h" |
| 101 #include "ui/gfx/win/dpi.h" | 101 #include "ui/gfx/screen_win.h" |
| 102 #endif | 102 #endif |
| 103 | 103 |
| 104 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 104 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 105 #include "content/common/input_messages.h" | 105 #include "content/common/input_messages.h" |
| 106 #include "ui/events/linux/text_edit_command_auralinux.h" | 106 #include "ui/events/linux/text_edit_command_auralinux.h" |
| 107 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" | 107 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" |
| 108 #endif | 108 #endif |
| 109 | 109 |
| 110 using gfx::RectToSkIRect; | 110 using gfx::RectToSkIRect; |
| 111 using gfx::SkIRectToRect; | 111 using gfx::SkIRectToRect; |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1149 params.widget = this; | 1149 params.widget = this; |
| 1150 params.cutout_rects = constrained_rects_; | 1150 params.cutout_rects = constrained_rects_; |
| 1151 params.geometry = &plugin_window_moves_; | 1151 params.geometry = &plugin_window_moves_; |
| 1152 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); | 1152 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); |
| 1153 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 1153 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 1156 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
| 1157 // Clip the cursor if chrome is running on regular desktop. | 1157 // Clip the cursor if chrome is running on regular desktop. |
| 1158 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { | 1158 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { |
| 1159 RECT window_rect = | 1159 RECT window_rect = gfx::ScreenWin::DIPToScreenRect( |
| 1160 gfx::win::DIPToScreenRect(window_->GetBoundsInScreen()).ToRECT(); | 1160 window_->GetHost()->GetAcceleratedWidget(), |
| 1161 window_->GetBoundsInScreen()).ToRECT(); | |
| 1161 ::ClipCursor(&window_rect); | 1162 ::ClipCursor(&window_rect); |
| 1162 } | 1163 } |
| 1163 } | 1164 } |
| 1164 | 1165 |
| 1165 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 1166 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
| 1166 legacy_render_widget_host_HWND_ = NULL; | 1167 legacy_render_widget_host_HWND_ = NULL; |
| 1167 legacy_window_destroyed_ = true; | 1168 legacy_window_destroyed_ = true; |
| 1168 } | 1169 } |
| 1169 #endif | 1170 #endif |
| 1170 | 1171 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1229 } | 1230 } |
| 1230 | 1231 |
| 1231 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1232 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
| 1232 aura::Window* top_level = window_->GetToplevelWindow(); | 1233 aura::Window* top_level = window_->GetToplevelWindow(); |
| 1233 gfx::Rect bounds(top_level->GetBoundsInScreen()); | 1234 gfx::Rect bounds(top_level->GetBoundsInScreen()); |
| 1234 | 1235 |
| 1235 #if defined(OS_WIN) | 1236 #if defined(OS_WIN) |
| 1236 // TODO(zturner,iyengar): This will break when we remove support for NPAPI and | 1237 // TODO(zturner,iyengar): This will break when we remove support for NPAPI and |
| 1237 // remove the legacy hwnd, so a better fix will need to be decided when that | 1238 // remove the legacy hwnd, so a better fix will need to be decided when that |
| 1238 // happens. | 1239 // happens. |
| 1240 aura::WindowTreeHost* host = top_level->GetHost(); | |
| 1239 if (UsesNativeWindowFrame()) { | 1241 if (UsesNativeWindowFrame()) { |
| 1240 // aura::Window doesn't take into account non-client area of native windows | 1242 // aura::Window doesn't take into account non-client area of native windows |
| 1241 // (e.g. HWNDs), so for that case ask Windows directly what the bounds are. | 1243 // (e.g. HWNDs), so for that case ask Windows directly what the bounds are. |
| 1242 aura::WindowTreeHost* host = top_level->GetHost(); | |
| 1243 if (!host) | 1244 if (!host) |
| 1244 return top_level->GetBoundsInScreen(); | 1245 return top_level->GetBoundsInScreen(); |
| 1245 RECT window_rect = {0}; | 1246 RECT window_rect = {0}; |
| 1246 HWND hwnd = host->GetAcceleratedWidget(); | 1247 HWND hwnd = host->GetAcceleratedWidget(); |
| 1247 ::GetWindowRect(hwnd, &window_rect); | 1248 ::GetWindowRect(hwnd, &window_rect); |
| 1248 bounds = gfx::Rect(window_rect); | 1249 bounds = gfx::Rect(window_rect); |
| 1249 | 1250 |
| 1250 // Maximized windows are outdented from the work area by the frame thickness | 1251 // Maximized windows are outdented from the work area by the frame thickness |
| 1251 // even though this "frame" is not painted. This confuses code (and people) | 1252 // even though this "frame" is not painted. This confuses code (and people) |
| 1252 // that think of a maximized window as corresponding exactly to the work | 1253 // that think of a maximized window as corresponding exactly to the work |
| 1253 // area. Correct for this by subtracting the frame thickness back off. | 1254 // area. Correct for this by subtracting the frame thickness back off. |
| 1254 if (::IsZoomed(hwnd)) { | 1255 if (::IsZoomed(hwnd)) { |
| 1255 bounds.Inset(GetSystemMetrics(SM_CXSIZEFRAME), | 1256 bounds.Inset(GetSystemMetrics(SM_CXSIZEFRAME), |
| 1256 GetSystemMetrics(SM_CYSIZEFRAME)); | 1257 GetSystemMetrics(SM_CYSIZEFRAME)); |
| 1257 | 1258 |
| 1258 bounds.Inset(GetSystemMetrics(SM_CXPADDEDBORDER), | 1259 bounds.Inset(GetSystemMetrics(SM_CXPADDEDBORDER), |
| 1259 GetSystemMetrics(SM_CXPADDEDBORDER)); | 1260 GetSystemMetrics(SM_CXPADDEDBORDER)); |
| 1260 } | 1261 } |
| 1261 } | 1262 } |
| 1262 | 1263 |
| 1263 bounds = gfx::win::ScreenToDIPRect(bounds); | 1264 bounds = gfx::ScreenWin::ScreenToDIPRect( |
| 1265 host ? host->GetAcceleratedWidget() : nullptr, bounds); | |
|
scottmg
2015/10/28 18:48:21
What do we do when nullptr?
robliao
2015/10/29 00:30:24
This will tell ScreenToDIPRect to use the nearest
| |
| 1264 #endif | 1266 #endif |
| 1265 | 1267 |
| 1266 return bounds; | 1268 return bounds; |
| 1267 } | 1269 } |
| 1268 | 1270 |
| 1269 void RenderWidgetHostViewAura::WheelEventAck( | 1271 void RenderWidgetHostViewAura::WheelEventAck( |
| 1270 const blink::WebMouseWheelEvent& event, | 1272 const blink::WebMouseWheelEvent& event, |
| 1271 InputEventAckState ack_result) { | 1273 InputEventAckState ack_result) { |
| 1272 if (overscroll_controller_) { | 1274 if (overscroll_controller_) { |
| 1273 overscroll_controller_->ReceivedEventACK( | 1275 overscroll_controller_->ReceivedEventACK( |
| (...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2899 | 2901 |
| 2900 //////////////////////////////////////////////////////////////////////////////// | 2902 //////////////////////////////////////////////////////////////////////////////// |
| 2901 // RenderWidgetHostViewBase, public: | 2903 // RenderWidgetHostViewBase, public: |
| 2902 | 2904 |
| 2903 // static | 2905 // static |
| 2904 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2906 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2905 GetScreenInfoForWindow(results, NULL); | 2907 GetScreenInfoForWindow(results, NULL); |
| 2906 } | 2908 } |
| 2907 | 2909 |
| 2908 } // namespace content | 2910 } // namespace content |
| OLD | NEW |