| 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.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "content/public/common/result_codes.h" | 33 #include "content/public/common/result_codes.h" |
| 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
| 35 #include "ui/base/keycodes/keyboard_codes.h" | 35 #include "ui/base/keycodes/keyboard_codes.h" |
| 36 #include "webkit/glue/webcursor.h" | 36 #include "webkit/glue/webcursor.h" |
| 37 #include "webkit/glue/webpreferences.h" | 37 #include "webkit/glue/webpreferences.h" |
| 38 #include "webkit/plugins/npapi/webplugin.h" | 38 #include "webkit/plugins/npapi/webplugin.h" |
| 39 | 39 |
| 40 using base::Time; | 40 using base::Time; |
| 41 using base::TimeDelta; | 41 using base::TimeDelta; |
| 42 using base::TimeTicks; | 42 using base::TimeTicks; |
| 43 using content::RenderWidgetHostViewPort; |
| 43 using content::UserMetricsAction; | 44 using content::UserMetricsAction; |
| 44 using WebKit::WebGestureEvent; | 45 using WebKit::WebGestureEvent; |
| 45 using WebKit::WebInputEvent; | 46 using WebKit::WebInputEvent; |
| 46 using WebKit::WebKeyboardEvent; | 47 using WebKit::WebKeyboardEvent; |
| 47 using WebKit::WebMouseEvent; | 48 using WebKit::WebMouseEvent; |
| 48 using WebKit::WebMouseWheelEvent; | 49 using WebKit::WebMouseWheelEvent; |
| 49 using WebKit::WebTextDirection; | 50 using WebKit::WebTextDirection; |
| 50 | 51 |
| 51 // How long to (synchronously) wait for the renderer to respond with a | 52 // How long to (synchronously) wait for the renderer to respond with a |
| 52 // PaintRect message, when our backing-store is invalid, before giving up and | 53 // PaintRect message, when our backing-store is invalid, before giving up and |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Clear our current or cached backing store if either remains. | 146 // Clear our current or cached backing store if either remains. |
| 146 BackingStoreManager::RemoveBackingStore(this); | 147 BackingStoreManager::RemoveBackingStore(this); |
| 147 | 148 |
| 148 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); | 149 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); |
| 149 surface_id_ = 0; | 150 surface_id_ = 0; |
| 150 | 151 |
| 151 process_->Release(routing_id_); | 152 process_->Release(routing_id_); |
| 152 } | 153 } |
| 153 | 154 |
| 154 void RenderWidgetHost::SetView(RenderWidgetHostView* view) { | 155 void RenderWidgetHost::SetView(RenderWidgetHostView* view) { |
| 155 view_ = RenderWidgetHostViewBase::FromRWHV(view); | 156 view_ = RenderWidgetHostViewPort::FromRWHV(view); |
| 156 | 157 |
| 157 if (!view_) { | 158 if (!view_) { |
| 158 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 159 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 159 surface_id_, gfx::GLSurfaceHandle()); | 160 surface_id_, gfx::GLSurfaceHandle()); |
| 160 } | 161 } |
| 161 } | 162 } |
| 162 | 163 |
| 163 RenderWidgetHostView* RenderWidgetHost::view() const { | 164 RenderWidgetHostView* RenderWidgetHost::view() const { |
| 164 return view_; | 165 return view_; |
| 165 } | 166 } |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked()); | 845 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked()); |
| 845 if (pending_mouse_lock_request_) { | 846 if (pending_mouse_lock_request_) { |
| 846 pending_mouse_lock_request_ = false; | 847 pending_mouse_lock_request_ = false; |
| 847 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); | 848 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); |
| 848 } else if (IsMouseLocked()) { | 849 } else if (IsMouseLocked()) { |
| 849 view_->UnlockMouse(); | 850 view_->UnlockMouse(); |
| 850 } | 851 } |
| 851 } | 852 } |
| 852 | 853 |
| 853 bool RenderWidgetHost::IsMouseLocked() const { | 854 bool RenderWidgetHost::IsMouseLocked() const { |
| 854 return view_ ? view_->mouse_locked() : false; | 855 return view_ ? view_->IsMouseLocked() : false; |
| 855 } | 856 } |
| 856 | 857 |
| 857 bool RenderWidgetHost::IsFullscreen() const { | 858 bool RenderWidgetHost::IsFullscreen() const { |
| 858 return false; | 859 return false; |
| 859 } | 860 } |
| 860 | 861 |
| 861 void RenderWidgetHost::SetShouldAutoResize(bool enable) { | 862 void RenderWidgetHost::SetShouldAutoResize(bool enable) { |
| 862 // Note if this switches from true to false then one has to verify that the | 863 // Note if this switches from true to false then one has to verify that the |
| 863 // mechanics about all the messaging works. For example, what happens to a | 864 // mechanics about all the messaging works. For example, what happens to a |
| 864 // update message rect that was in progress from the render widget. Perhaps, | 865 // update message rect that was in progress from the render widget. Perhaps, |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 void RenderWidgetHost::OnMsgUnlockMouse() { | 1261 void RenderWidgetHost::OnMsgUnlockMouse() { |
| 1261 RejectMouseLockOrUnlockIfNecessary(); | 1262 RejectMouseLockOrUnlockIfNecessary(); |
| 1262 } | 1263 } |
| 1263 | 1264 |
| 1264 #if defined(OS_POSIX) || defined(USE_AURA) | 1265 #if defined(OS_POSIX) || defined(USE_AURA) |
| 1265 void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId window_id, | 1266 void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId window_id, |
| 1266 WebKit::WebScreenInfo* results) { | 1267 WebKit::WebScreenInfo* results) { |
| 1267 if (view_) | 1268 if (view_) |
| 1268 view_->GetScreenInfo(results); | 1269 view_->GetScreenInfo(results); |
| 1269 else | 1270 else |
| 1270 RenderWidgetHostViewBase::GetDefaultScreenInfo(results); | 1271 RenderWidgetHostViewPort::GetDefaultScreenInfo(results); |
| 1271 } | 1272 } |
| 1272 | 1273 |
| 1273 void RenderWidgetHost::OnMsgGetWindowRect(gfx::NativeViewId window_id, | 1274 void RenderWidgetHost::OnMsgGetWindowRect(gfx::NativeViewId window_id, |
| 1274 gfx::Rect* results) { | 1275 gfx::Rect* results) { |
| 1275 if (view_) | 1276 if (view_) |
| 1276 *results = view_->GetViewBounds(); | 1277 *results = view_->GetViewBounds(); |
| 1277 } | 1278 } |
| 1278 | 1279 |
| 1279 void RenderWidgetHost::OnMsgGetRootWindowRect(gfx::NativeViewId window_id, | 1280 void RenderWidgetHost::OnMsgGetRootWindowRect(gfx::NativeViewId window_id, |
| 1280 gfx::Rect* results) { | 1281 gfx::Rect* results) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1542 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
| 1542 } | 1543 } |
| 1543 | 1544 |
| 1544 // static | 1545 // static |
| 1545 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, | 1546 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, |
| 1546 int gpu_host_id) { | 1547 int gpu_host_id) { |
| 1547 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1548 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 1548 if (ui_shim) | 1549 if (ui_shim) |
| 1549 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1550 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
| 1550 } | 1551 } |
| OLD | NEW |