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 // Unlocks the mouse if this RenderWidgetHostView holds the lock. | |
82 UnlockMouse(); | |
Charlie Reis
2016/07/06 17:41:47
This seems a bit random to me. I wouldn't expect
lfg
2016/07/07 20:17:35
For both Aura and Mac, this cleanup happens in the
Charlie Reis
2016/07/07 21:47:12
Acknowledged.
| |
80 } | 83 } |
81 frame_connector_ = frame_connector; | 84 frame_connector_ = frame_connector; |
82 if (frame_connector_) { | 85 if (frame_connector_) { |
83 GetSurfaceManager()->RegisterSurfaceFactoryClient( | 86 GetSurfaceManager()->RegisterSurfaceFactoryClient( |
84 id_allocator_->id_namespace(), this); | 87 id_allocator_->id_namespace(), this); |
85 RenderWidgetHostViewBase* parent_view = | 88 RenderWidgetHostViewBase* parent_view = |
86 frame_connector_->GetParentRenderWidgetHostView(); | 89 frame_connector_->GetParentRenderWidgetHostView(); |
87 if (parent_view) { | 90 if (parent_view) { |
88 parent_surface_id_namespace_ = parent_view->GetSurfaceIdNamespace(); | 91 parent_surface_id_namespace_ = parent_view->GetSurfaceIdNamespace(); |
89 DCHECK_NE(parent_surface_id_namespace_, 0u); | 92 DCHECK_NE(parent_surface_id_namespace_, 0u); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 frame_connector_->ForwardProcessAckedTouchEvent(touch, ack_result); | 471 frame_connector_->ForwardProcessAckedTouchEvent(touch, ack_result); |
469 } | 472 } |
470 | 473 |
471 bool RenderWidgetHostViewChildFrame::LockMouse() { | 474 bool RenderWidgetHostViewChildFrame::LockMouse() { |
472 if (frame_connector_) | 475 if (frame_connector_) |
473 return frame_connector_->LockMouse(); | 476 return frame_connector_->LockMouse(); |
474 return false; | 477 return false; |
475 } | 478 } |
476 | 479 |
477 void RenderWidgetHostViewChildFrame::UnlockMouse() { | 480 void RenderWidgetHostViewChildFrame::UnlockMouse() { |
481 if (host_->delegate() && host_->delegate()->HasMouseLock(host_) && | |
482 frame_connector_) | |
483 frame_connector_->UnlockMouse(); | |
478 } | 484 } |
479 | 485 |
480 bool RenderWidgetHostViewChildFrame::IsMouseLocked() { | 486 bool RenderWidgetHostViewChildFrame::IsMouseLocked() { |
481 if (!frame_connector_) | 487 if (!host_->delegate()) |
482 return false; | 488 return false; |
483 | 489 |
484 RenderWidgetHostViewBase* root_view = | 490 return host_->delegate()->HasMouseLock(host_); |
485 frame_connector_->GetRootRenderWidgetHostView(); | |
486 | |
487 if (root_view) | |
488 return root_view->IsMouseLocked(); | |
489 | |
490 return false; | |
491 } | 491 } |
492 | 492 |
493 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { | 493 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { |
494 return id_allocator_->id_namespace(); | 494 return id_allocator_->id_namespace(); |
495 } | 495 } |
496 | 496 |
497 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent( | 497 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent( |
498 const NativeWebKeyboardEvent& event) { | 498 const NativeWebKeyboardEvent& event) { |
499 host_->ForwardKeyboardEvent(event); | 499 host_->ForwardKeyboardEvent(event); |
500 } | 500 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
694 | 694 |
695 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 695 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
696 return true; | 696 return true; |
697 } | 697 } |
698 | 698 |
699 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 699 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
700 return surface_id_; | 700 return surface_id_; |
701 }; | 701 }; |
702 | 702 |
703 } // namespace content | 703 } // namespace content |
OLD | NEW |