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_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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 | 226 |
| 227 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 227 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 228 surface_id_, GetCompositingSurface()); | 228 surface_id_, GetCompositingSurface()); |
| 229 | 229 |
| 230 // Send the ack along with the information on placement. | 230 // Send the ack along with the information on placement. |
| 231 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); | 231 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); |
| 232 WasResized(); | 232 WasResized(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void RenderWidgetHostImpl::Shutdown() { | 235 void RenderWidgetHostImpl::Shutdown() { |
| 236 RejectMouseLockOrUnlockIfNecessary(); | |
| 237 | |
| 236 if (process_->HasConnection()) { | 238 if (process_->HasConnection()) { |
| 237 // Tell the renderer object to close. | 239 // Tell the renderer object to close. |
| 238 bool rv = Send(new ViewMsg_Close(routing_id_)); | 240 bool rv = Send(new ViewMsg_Close(routing_id_)); |
| 239 DCHECK(rv); | 241 DCHECK(rv); |
| 240 } | 242 } |
| 241 | 243 |
| 242 Destroy(); | 244 Destroy(); |
| 243 } | 245 } |
| 244 | 246 |
| 245 bool RenderWidgetHostImpl::IsLoading() const { | 247 bool RenderWidgetHostImpl::IsLoading() const { |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1478 void RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing( | 1480 void RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing( |
| 1479 bool activated) { | 1481 bool activated) { |
| 1480 TRACE_EVENT1("renderer_host", | 1482 TRACE_EVENT1("renderer_host", |
| 1481 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing", | 1483 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing", |
| 1482 "activated", activated); | 1484 "activated", activated); |
| 1483 is_accelerated_compositing_active_ = activated; | 1485 is_accelerated_compositing_active_ = activated; |
| 1484 if (view_) | 1486 if (view_) |
| 1485 view_->OnAcceleratedCompositingStateChange(); | 1487 view_->OnAcceleratedCompositingStateChange(); |
| 1486 } | 1488 } |
| 1487 | 1489 |
| 1488 void RenderWidgetHostImpl::OnMsgLockMouse(bool user_gesture) { | 1490 void RenderWidgetHostImpl::OnMsgLockMouse(bool user_gesture, bool privileged) { |
| 1489 if (pending_mouse_lock_request_) { | 1491 if (pending_mouse_lock_request_) { |
| 1490 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); | 1492 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); |
| 1491 return; | 1493 return; |
| 1492 } else if (IsMouseLocked()) { | 1494 } else if (IsMouseLocked()) { |
| 1493 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 1495 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
| 1494 return; | 1496 return; |
| 1495 } | 1497 } |
| 1496 | 1498 |
| 1497 pending_mouse_lock_request_ = true; | 1499 pending_mouse_lock_request_ = true; |
| 1498 RequestToLockMouse(user_gesture); | 1500 if (privileged) { |
|
brettw
2012/05/29 20:20:09
Are there security considerations here? I'm not su
| |
| 1501 // Directly approve to lock the mouse. | |
| 1502 GotResponseToLockMouseRequest(true); | |
| 1503 } else { | |
| 1504 RequestToLockMouse(user_gesture); | |
| 1505 } | |
| 1499 } | 1506 } |
| 1500 | 1507 |
| 1501 void RenderWidgetHostImpl::OnMsgUnlockMouse() { | 1508 void RenderWidgetHostImpl::OnMsgUnlockMouse() { |
| 1502 RejectMouseLockOrUnlockIfNecessary(); | 1509 RejectMouseLockOrUnlockIfNecessary(); |
| 1503 } | 1510 } |
| 1504 | 1511 |
| 1505 #if defined(OS_POSIX) || defined(USE_AURA) | 1512 #if defined(OS_POSIX) || defined(USE_AURA) |
| 1506 void RenderWidgetHostImpl::OnMsgGetWindowRect(gfx::NativeViewId window_id, | 1513 void RenderWidgetHostImpl::OnMsgGetWindowRect(gfx::NativeViewId window_id, |
| 1507 gfx::Rect* results) { | 1514 gfx::Rect* results) { |
| 1508 if (view_) | 1515 if (view_) |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1784 // indicate that no callback is in progress (i.e. without this line | 1791 // indicate that no callback is in progress (i.e. without this line |
| 1785 // DelayedAutoResized will not get called again). | 1792 // DelayedAutoResized will not get called again). |
| 1786 new_auto_size_.SetSize(0, 0); | 1793 new_auto_size_.SetSize(0, 0); |
| 1787 if (!should_auto_resize_) | 1794 if (!should_auto_resize_) |
| 1788 return; | 1795 return; |
| 1789 | 1796 |
| 1790 OnRenderAutoResized(new_size); | 1797 OnRenderAutoResized(new_size); |
| 1791 } | 1798 } |
| 1792 | 1799 |
| 1793 } // namespace content | 1800 } // namespace content |
| OLD | NEW |