| 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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 in_flight_event_count_(0), | 123 in_flight_event_count_(0), |
| 124 in_get_backing_store_(false), | 124 in_get_backing_store_(false), |
| 125 abort_get_backing_store_(false), | 125 abort_get_backing_store_(false), |
| 126 view_being_painted_(false), | 126 view_being_painted_(false), |
| 127 ignore_input_events_(false), | 127 ignore_input_events_(false), |
| 128 text_direction_updated_(false), | 128 text_direction_updated_(false), |
| 129 text_direction_(WebKit::WebTextDirectionLeftToRight), | 129 text_direction_(WebKit::WebTextDirectionLeftToRight), |
| 130 text_direction_canceled_(false), | 130 text_direction_canceled_(false), |
| 131 suppress_next_char_events_(false), | 131 suppress_next_char_events_(false), |
| 132 pending_mouse_lock_request_(false), | 132 pending_mouse_lock_request_(false), |
| 133 allow_privileged_mouse_lock_(false), |
| 133 has_touch_handler_(false), | 134 has_touch_handler_(false), |
| 134 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 135 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 135 tap_suppression_controller_(new TapSuppressionController(this)) { | 136 tap_suppression_controller_(new TapSuppressionController(this)) { |
| 136 CHECK(delegate_); | 137 CHECK(delegate_); |
| 137 if (routing_id_ == MSG_ROUTING_NONE) { | 138 if (routing_id_ == MSG_ROUTING_NONE) { |
| 138 routing_id_ = process_->GetNextRoutingID(); | 139 routing_id_ = process_->GetNextRoutingID(); |
| 139 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 140 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
| 140 process_->GetID(), | 141 process_->GetID(), |
| 141 routing_id_); | 142 routing_id_); |
| 142 } else { | 143 } else { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 227 |
| 227 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 228 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 228 surface_id_, GetCompositingSurface()); | 229 surface_id_, GetCompositingSurface()); |
| 229 | 230 |
| 230 // Send the ack along with the information on placement. | 231 // Send the ack along with the information on placement. |
| 231 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); | 232 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); |
| 232 WasResized(); | 233 WasResized(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 void RenderWidgetHostImpl::Shutdown() { | 236 void RenderWidgetHostImpl::Shutdown() { |
| 237 RejectMouseLockOrUnlockIfNecessary(); |
| 238 |
| 236 if (process_->HasConnection()) { | 239 if (process_->HasConnection()) { |
| 237 // Tell the renderer object to close. | 240 // Tell the renderer object to close. |
| 238 bool rv = Send(new ViewMsg_Close(routing_id_)); | 241 bool rv = Send(new ViewMsg_Close(routing_id_)); |
| 239 DCHECK(rv); | 242 DCHECK(rv); |
| 240 } | 243 } |
| 241 | 244 |
| 242 Destroy(); | 245 Destroy(); |
| 243 } | 246 } |
| 244 | 247 |
| 245 bool RenderWidgetHostImpl::IsLoading() const { | 248 bool RenderWidgetHostImpl::IsLoading() const { |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 bool activated) { | 1484 bool activated) { |
| 1482 TRACE_EVENT1("renderer_host", | 1485 TRACE_EVENT1("renderer_host", |
| 1483 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing", | 1486 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing", |
| 1484 "activated", activated); | 1487 "activated", activated); |
| 1485 is_accelerated_compositing_active_ = activated; | 1488 is_accelerated_compositing_active_ = activated; |
| 1486 if (view_) | 1489 if (view_) |
| 1487 view_->OnAcceleratedCompositingStateChange(); | 1490 view_->OnAcceleratedCompositingStateChange(); |
| 1488 } | 1491 } |
| 1489 | 1492 |
| 1490 void RenderWidgetHostImpl::OnMsgLockMouse(bool user_gesture, | 1493 void RenderWidgetHostImpl::OnMsgLockMouse(bool user_gesture, |
| 1491 bool last_unlocked_by_target) { | 1494 bool last_unlocked_by_target, |
| 1495 bool privileged) { |
| 1492 | 1496 |
| 1493 if (pending_mouse_lock_request_) { | 1497 if (pending_mouse_lock_request_) { |
| 1494 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); | 1498 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); |
| 1495 return; | 1499 return; |
| 1496 } else if (IsMouseLocked()) { | 1500 } else if (IsMouseLocked()) { |
| 1497 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 1501 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
| 1498 return; | 1502 return; |
| 1499 } | 1503 } |
| 1500 | 1504 |
| 1501 pending_mouse_lock_request_ = true; | 1505 pending_mouse_lock_request_ = true; |
| 1502 RequestToLockMouse(user_gesture, last_unlocked_by_target); | 1506 if (privileged && allow_privileged_mouse_lock_) { |
| 1507 // Directly approve to lock the mouse. |
| 1508 GotResponseToLockMouseRequest(true); |
| 1509 } else { |
| 1510 RequestToLockMouse(user_gesture, last_unlocked_by_target); |
| 1511 } |
| 1503 } | 1512 } |
| 1504 | 1513 |
| 1505 void RenderWidgetHostImpl::OnMsgUnlockMouse() { | 1514 void RenderWidgetHostImpl::OnMsgUnlockMouse() { |
| 1506 RejectMouseLockOrUnlockIfNecessary(); | 1515 RejectMouseLockOrUnlockIfNecessary(); |
| 1507 } | 1516 } |
| 1508 | 1517 |
| 1509 #if defined(OS_POSIX) || defined(USE_AURA) | 1518 #if defined(OS_POSIX) || defined(USE_AURA) |
| 1510 void RenderWidgetHostImpl::OnMsgGetScreenInfo(gfx::NativeViewId window_id, | 1519 void RenderWidgetHostImpl::OnMsgGetScreenInfo(gfx::NativeViewId window_id, |
| 1511 WebKit::WebScreenInfo* results) { | 1520 WebKit::WebScreenInfo* results) { |
| 1512 if (view_) | 1521 if (view_) |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 // indicate that no callback is in progress (i.e. without this line | 1805 // indicate that no callback is in progress (i.e. without this line |
| 1797 // DelayedAutoResized will not get called again). | 1806 // DelayedAutoResized will not get called again). |
| 1798 new_auto_size_.SetSize(0, 0); | 1807 new_auto_size_.SetSize(0, 0); |
| 1799 if (!should_auto_resize_) | 1808 if (!should_auto_resize_) |
| 1800 return; | 1809 return; |
| 1801 | 1810 |
| 1802 OnRenderAutoResized(new_size); | 1811 OnRenderAutoResized(new_size); |
| 1803 } | 1812 } |
| 1804 | 1813 |
| 1805 } // namespace content | 1814 } // namespace content |
| OLD | NEW |