| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Clear our current or cached backing store if either remains. | 147 // Clear our current or cached backing store if either remains. |
| 147 BackingStoreManager::RemoveBackingStore(this); | 148 BackingStoreManager::RemoveBackingStore(this); |
| 148 | 149 |
| 149 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); | 150 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); |
| 150 surface_id_ = 0; | 151 surface_id_ = 0; |
| 151 | 152 |
| 152 process_->Release(routing_id_); | 153 process_->Release(routing_id_); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void RenderWidgetHost::SetView(RenderWidgetHostView* view) { | 156 void RenderWidgetHost::SetView(RenderWidgetHostView* view) { |
| 156 view_ = RenderWidgetHostViewBase::FromRWHV(view); | 157 view_ = RenderWidgetHostViewPort::FromRWHV(view); |
| 157 | 158 |
| 158 if (!view_) { | 159 if (!view_) { |
| 159 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 160 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 160 surface_id_, gfx::GLSurfaceHandle()); | 161 surface_id_, gfx::GLSurfaceHandle()); |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 164 RenderWidgetHostView* RenderWidgetHost::view() const { | 165 RenderWidgetHostView* RenderWidgetHost::view() const { |
| 165 return view_; | 166 return view_; |
| 166 } | 167 } |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked()); | 848 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked()); |
| 848 if (pending_mouse_lock_request_) { | 849 if (pending_mouse_lock_request_) { |
| 849 pending_mouse_lock_request_ = false; | 850 pending_mouse_lock_request_ = false; |
| 850 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); | 851 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); |
| 851 } else if (IsMouseLocked()) { | 852 } else if (IsMouseLocked()) { |
| 852 view_->UnlockMouse(); | 853 view_->UnlockMouse(); |
| 853 } | 854 } |
| 854 } | 855 } |
| 855 | 856 |
| 856 bool RenderWidgetHost::IsMouseLocked() const { | 857 bool RenderWidgetHost::IsMouseLocked() const { |
| 857 return view_ ? view_->mouse_locked() : false; | 858 return view_ ? view_->IsMouseLocked() : false; |
| 858 } | 859 } |
| 859 | 860 |
| 860 bool RenderWidgetHost::IsFullscreen() const { | 861 bool RenderWidgetHost::IsFullscreen() const { |
| 861 return false; | 862 return false; |
| 862 } | 863 } |
| 863 | 864 |
| 864 void RenderWidgetHost::SetShouldAutoResize(bool enable) { | 865 void RenderWidgetHost::SetShouldAutoResize(bool enable) { |
| 865 // Note if this switches from true to false then one has to verify that the | 866 // Note if this switches from true to false then one has to verify that the |
| 866 // mechanics about all the messaging works. For example, what happens to a | 867 // mechanics about all the messaging works. For example, what happens to a |
| 867 // update message rect that was in progress from the render widget. Perhaps, | 868 // update message rect that was in progress from the render widget. Perhaps, |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 void RenderWidgetHost::OnMsgUnlockMouse() { | 1268 void RenderWidgetHost::OnMsgUnlockMouse() { |
| 1268 RejectMouseLockOrUnlockIfNecessary(); | 1269 RejectMouseLockOrUnlockIfNecessary(); |
| 1269 } | 1270 } |
| 1270 | 1271 |
| 1271 #if defined(OS_POSIX) || defined(USE_AURA) | 1272 #if defined(OS_POSIX) || defined(USE_AURA) |
| 1272 void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId window_id, | 1273 void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId window_id, |
| 1273 WebKit::WebScreenInfo* results) { | 1274 WebKit::WebScreenInfo* results) { |
| 1274 if (view_) | 1275 if (view_) |
| 1275 view_->GetScreenInfo(results); | 1276 view_->GetScreenInfo(results); |
| 1276 else | 1277 else |
| 1277 RenderWidgetHostViewBase::GetDefaultScreenInfo(results); | 1278 RenderWidgetHostViewPort::GetDefaultScreenInfo(results); |
| 1278 } | 1279 } |
| 1279 | 1280 |
| 1280 void RenderWidgetHost::OnMsgGetWindowRect(gfx::NativeViewId window_id, | 1281 void RenderWidgetHost::OnMsgGetWindowRect(gfx::NativeViewId window_id, |
| 1281 gfx::Rect* results) { | 1282 gfx::Rect* results) { |
| 1282 if (view_) | 1283 if (view_) |
| 1283 *results = view_->GetViewBounds(); | 1284 *results = view_->GetViewBounds(); |
| 1284 } | 1285 } |
| 1285 | 1286 |
| 1286 void RenderWidgetHost::OnMsgGetRootWindowRect(gfx::NativeViewId window_id, | 1287 void RenderWidgetHost::OnMsgGetRootWindowRect(gfx::NativeViewId window_id, |
| 1287 gfx::Rect* results) { | 1288 gfx::Rect* results) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1549 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
| 1549 } | 1550 } |
| 1550 | 1551 |
| 1551 // static | 1552 // static |
| 1552 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, | 1553 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, |
| 1553 int gpu_host_id) { | 1554 int gpu_host_id) { |
| 1554 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1555 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 1555 if (ui_shim) | 1556 if (ui_shim) |
| 1556 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1557 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
| 1557 } | 1558 } |
| OLD | NEW |