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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1676 delegate_->ExitFullscreenModeForTab(this); | 1676 delegate_->ExitFullscreenModeForTab(this); |
1677 FOR_EACH_OBSERVER(WebContentsObserver, | 1677 FOR_EACH_OBSERVER(WebContentsObserver, |
1678 observers_, | 1678 observers_, |
1679 DidDestroyFullscreenWidget()); | 1679 DidDestroyFullscreenWidget()); |
1680 fullscreen_widget_process_id_ = ChildProcessHost::kInvalidUniqueID; | 1680 fullscreen_widget_process_id_ = ChildProcessHost::kInvalidUniqueID; |
1681 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; | 1681 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; |
1682 if (fullscreen_widget_had_focus_at_shutdown_) | 1682 if (fullscreen_widget_had_focus_at_shutdown_) |
1683 view_->RestoreFocus(); | 1683 view_->RestoreFocus(); |
1684 } | 1684 } |
1685 | 1685 |
1686 if (mouse_lock_widget_ == render_widget_host) | 1686 DCHECK(mouse_lock_widget_ != render_widget_host); |
Charlie Reis
2016/07/06 17:41:47
DCHECKs aren't compiled into release builds, so th
lfg
2016/07/07 20:17:35
Let's change it to a CHECK then, so we can force a
Charlie Reis
2016/07/07 21:47:12
Acknowledged.
| |
1687 mouse_lock_widget_ = nullptr; | |
1688 } | 1687 } |
1689 | 1688 |
1690 void WebContentsImpl::RenderWidgetGotFocus( | 1689 void WebContentsImpl::RenderWidgetGotFocus( |
1691 RenderWidgetHostImpl* render_widget_host) { | 1690 RenderWidgetHostImpl* render_widget_host) { |
1692 // Notify the observers if an embedded fullscreen widget was focused. | 1691 // Notify the observers if an embedded fullscreen widget was focused. |
1693 if (delegate_ && render_widget_host && delegate_->EmbedsFullscreenWidget() && | 1692 if (delegate_ && render_widget_host && delegate_->EmbedsFullscreenWidget() && |
1694 render_widget_host->GetView() == GetFullscreenRenderWidgetHostView()) { | 1693 render_widget_host->GetView() == GetFullscreenRenderWidgetHostView()) { |
1695 NotifyWebContentsFocused(); | 1694 NotifyWebContentsFocused(); |
1696 } | 1695 } |
1697 } | 1696 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1898 | 1897 |
1899 void WebContentsImpl::LostMouseLock(RenderWidgetHostImpl* render_widget_host) { | 1898 void WebContentsImpl::LostMouseLock(RenderWidgetHostImpl* render_widget_host) { |
1900 CHECK(mouse_lock_widget_); | 1899 CHECK(mouse_lock_widget_); |
1901 mouse_lock_widget_->SendMouseLockLost(); | 1900 mouse_lock_widget_->SendMouseLockLost(); |
1902 mouse_lock_widget_ = nullptr; | 1901 mouse_lock_widget_ = nullptr; |
1903 | 1902 |
1904 if (delegate_) | 1903 if (delegate_) |
1905 delegate_->LostMouseLock(); | 1904 delegate_->LostMouseLock(); |
1906 } | 1905 } |
1907 | 1906 |
1907 bool WebContentsImpl::HasMouseLock(RenderWidgetHostImpl* render_widget_host) { | |
1908 return mouse_lock_widget_ == render_widget_host && | |
1909 GetTopLevelRenderWidgetHostView()->IsMouseLocked(); | |
Charlie Reis
2016/07/06 17:41:47
This is confusing to me at first glance. Why is i
lfg
2016/07/07 20:17:35
There's two parts to this. First the mouse_lock_wi
Charlie Reis
2016/07/07 21:47:12
Acknowledged.
| |
1910 } | |
1911 | |
1908 void WebContentsImpl::ForwardCompositorProto( | 1912 void WebContentsImpl::ForwardCompositorProto( |
1909 RenderWidgetHostImpl* render_widget_host, | 1913 RenderWidgetHostImpl* render_widget_host, |
1910 const std::vector<uint8_t>& proto) { | 1914 const std::vector<uint8_t>& proto) { |
1911 if (delegate_) | 1915 if (delegate_) |
1912 delegate_->ForwardCompositorProto(render_widget_host, proto); | 1916 delegate_->ForwardCompositorProto(render_widget_host, proto); |
1913 } | 1917 } |
1914 | 1918 |
1915 void WebContentsImpl::OnRenderFrameProxyVisibilityChanged(bool visible) { | 1919 void WebContentsImpl::OnRenderFrameProxyVisibilityChanged(bool visible) { |
1916 if (visible) | 1920 if (visible) |
1917 WasShown(); | 1921 WasShown(); |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2955 } | 2959 } |
2956 | 2960 |
2957 gfx::Size WebContentsImpl::GetPreferredSize() const { | 2961 gfx::Size WebContentsImpl::GetPreferredSize() const { |
2958 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; | 2962 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; |
2959 } | 2963 } |
2960 | 2964 |
2961 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 2965 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
2962 if (GetBrowserPluginGuest()) | 2966 if (GetBrowserPluginGuest()) |
2963 return GetBrowserPluginGuest()->LockMouse(allowed); | 2967 return GetBrowserPluginGuest()->LockMouse(allowed); |
2964 | 2968 |
2965 if (mouse_lock_widget_) | 2969 if (mouse_lock_widget_ && |
2966 return mouse_lock_widget_->GotResponseToLockMouseRequest(allowed); | 2970 mouse_lock_widget_->GotResponseToLockMouseRequest(allowed)) |
2971 return true; | |
2972 | |
2973 mouse_lock_widget_ = nullptr; | |
2967 return false; | 2974 return false; |
2968 } | 2975 } |
2969 | 2976 |
2970 bool WebContentsImpl::HasOpener() const { | 2977 bool WebContentsImpl::HasOpener() const { |
2971 return GetOpener() != NULL; | 2978 return GetOpener() != NULL; |
2972 } | 2979 } |
2973 | 2980 |
2974 WebContentsImpl* WebContentsImpl::GetOpener() const { | 2981 WebContentsImpl* WebContentsImpl::GetOpener() const { |
2975 FrameTreeNode* opener_ftn = frame_tree_.root()->opener(); | 2982 FrameTreeNode* opener_ftn = frame_tree_.root()->opener(); |
2976 return opener_ftn ? FromFrameTreeNode(opener_ftn) : nullptr; | 2983 return opener_ftn ? FromFrameTreeNode(opener_ftn) : nullptr; |
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5125 for (RenderViewHost* render_view_host : render_view_host_set) | 5132 for (RenderViewHost* render_view_host : render_view_host_set) |
5126 render_view_host->OnWebkitPreferencesChanged(); | 5133 render_view_host->OnWebkitPreferencesChanged(); |
5127 } | 5134 } |
5128 | 5135 |
5129 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5136 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
5130 JavaScriptDialogManager* dialog_manager) { | 5137 JavaScriptDialogManager* dialog_manager) { |
5131 dialog_manager_ = dialog_manager; | 5138 dialog_manager_ = dialog_manager; |
5132 } | 5139 } |
5133 | 5140 |
5134 } // namespace content | 5141 } // namespace content |
OLD | NEW |