Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 if (parent_surface_id_namespace_) { | 70 if (parent_surface_id_namespace_) { |
| 71 GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( | 71 GetSurfaceManager()->UnregisterSurfaceNamespaceHierarchy( |
| 72 parent_surface_id_namespace_, GetSurfaceIdNamespace()); | 72 parent_surface_id_namespace_, GetSurfaceIdNamespace()); |
| 73 } | 73 } |
| 74 // Unregister the client here, as it is not guaranteed in tests that the | 74 // Unregister the client here, as it is not guaranteed in tests that the |
| 75 // destructor will be called. | 75 // destructor will be called. |
| 76 GetSurfaceManager()->UnregisterSurfaceFactoryClient( | 76 GetSurfaceManager()->UnregisterSurfaceFactoryClient( |
| 77 id_allocator_->id_namespace()); | 77 id_allocator_->id_namespace()); |
| 78 | 78 |
| 79 parent_surface_id_namespace_ = 0; | 79 parent_surface_id_namespace_ = 0; |
| 80 | |
| 81 // After the RenderWidgetHostViewChildFrame loses the frame_connector, it | |
| 82 // won't be able to walk up the frame tree anymore. Cleanup anything that | |
| 83 // needs to be done through the CrossProcessFrameConnector. | |
|
Charlie Reis
2016/07/07 21:47:13
nit: s/Cleanup/Clean up/
nit: Add "before it's gon
lfg
2016/07/11 19:11:29
Done.
| |
| 84 // Unlocks the mouse if this RenderWidgetHostView holds the lock. | |
| 85 UnlockMouse(); | |
| 80 } | 86 } |
| 81 frame_connector_ = frame_connector; | 87 frame_connector_ = frame_connector; |
| 82 if (frame_connector_) { | 88 if (frame_connector_) { |
| 83 GetSurfaceManager()->RegisterSurfaceFactoryClient( | 89 GetSurfaceManager()->RegisterSurfaceFactoryClient( |
| 84 id_allocator_->id_namespace(), this); | 90 id_allocator_->id_namespace(), this); |
| 85 RenderWidgetHostViewBase* parent_view = | 91 RenderWidgetHostViewBase* parent_view = |
| 86 frame_connector_->GetParentRenderWidgetHostView(); | 92 frame_connector_->GetParentRenderWidgetHostView(); |
| 87 if (parent_view) { | 93 if (parent_view) { |
| 88 parent_surface_id_namespace_ = parent_view->GetSurfaceIdNamespace(); | 94 parent_surface_id_namespace_ = parent_view->GetSurfaceIdNamespace(); |
| 89 DCHECK_NE(parent_surface_id_namespace_, 0u); | 95 DCHECK_NE(parent_surface_id_namespace_, 0u); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 frame_connector_->ForwardProcessAckedTouchEvent(touch, ack_result); | 468 frame_connector_->ForwardProcessAckedTouchEvent(touch, ack_result); |
| 463 } | 469 } |
| 464 | 470 |
| 465 bool RenderWidgetHostViewChildFrame::LockMouse() { | 471 bool RenderWidgetHostViewChildFrame::LockMouse() { |
| 466 if (frame_connector_) | 472 if (frame_connector_) |
| 467 return frame_connector_->LockMouse(); | 473 return frame_connector_->LockMouse(); |
| 468 return false; | 474 return false; |
| 469 } | 475 } |
| 470 | 476 |
| 471 void RenderWidgetHostViewChildFrame::UnlockMouse() { | 477 void RenderWidgetHostViewChildFrame::UnlockMouse() { |
| 478 if (host_->delegate() && host_->delegate()->HasMouseLock(host_) && | |
| 479 frame_connector_) | |
| 480 frame_connector_->UnlockMouse(); | |
| 472 } | 481 } |
| 473 | 482 |
| 474 bool RenderWidgetHostViewChildFrame::IsMouseLocked() { | 483 bool RenderWidgetHostViewChildFrame::IsMouseLocked() { |
| 475 if (!frame_connector_) | 484 if (!host_->delegate()) |
| 476 return false; | 485 return false; |
| 477 | 486 |
| 478 RenderWidgetHostViewBase* root_view = | 487 return host_->delegate()->HasMouseLock(host_); |
| 479 frame_connector_->GetRootRenderWidgetHostView(); | |
| 480 | |
| 481 if (root_view) | |
| 482 return root_view->IsMouseLocked(); | |
| 483 | |
| 484 return false; | |
| 485 } | 488 } |
| 486 | 489 |
| 487 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { | 490 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { |
| 488 return id_allocator_->id_namespace(); | 491 return id_allocator_->id_namespace(); |
| 489 } | 492 } |
| 490 | 493 |
| 491 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent( | 494 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent( |
| 492 const NativeWebKeyboardEvent& event) { | 495 const NativeWebKeyboardEvent& event) { |
| 493 host_->ForwardKeyboardEvent(event); | 496 host_->ForwardKeyboardEvent(event); |
| 494 } | 497 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 688 | 691 |
| 689 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 692 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 690 return true; | 693 return true; |
| 691 } | 694 } |
| 692 | 695 |
| 693 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 696 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 694 return surface_id_; | 697 return surface_id_; |
| 695 }; | 698 }; |
| 696 | 699 |
| 697 } // namespace content | 700 } // namespace content |
| OLD | NEW |