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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1636 void WebContentsImpl::ShowCreatedWidget(int route_id, |
1637 bool is_fullscreen, | 1637 bool is_fullscreen, |
1638 const gfx::Rect& initial_pos) { | 1638 const gfx::Rect& initial_pos) { |
1639 if (delegate_) | 1639 if (delegate_) |
1640 delegate_->RenderWidgetShowing(); | 1640 delegate_->RenderWidgetShowing(); |
1641 | 1641 |
1642 RenderWidgetHostViewPort* widget_host_view = | 1642 RenderWidgetHostViewPort* widget_host_view = |
1643 RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id)); | 1643 RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id)); |
1644 if (!widget_host_view) | 1644 if (!widget_host_view) |
1645 return; | 1645 return; |
1646 bool allow_privileged = false; | |
1647 if (is_fullscreen) { | 1646 if (is_fullscreen) { |
| 1647 DCHECK_EQ(MSG_ROUTING_NONE, fullscreen_widget_routing_id_); |
| 1648 fullscreen_widget_routing_id_ = route_id; |
1648 if (delegate_ && delegate_->EmbedsFullscreenWidget()) { | 1649 if (delegate_ && delegate_->EmbedsFullscreenWidget()) { |
1649 widget_host_view->InitAsChild(GetRenderWidgetHostView()->GetNativeView()); | 1650 widget_host_view->InitAsChild(GetRenderWidgetHostView()->GetNativeView()); |
1650 delegate_->ToggleFullscreenModeForTab(this, true); | 1651 delegate_->ToggleFullscreenModeForTab(this, true); |
1651 } else { | 1652 } else { |
1652 widget_host_view->InitAsFullscreen(GetRenderWidgetHostViewPort()); | 1653 widget_host_view->InitAsFullscreen(GetRenderWidgetHostViewPort()); |
1653 // Only allow privileged mouse lock for fullscreen render widget, which is | |
1654 // used to implement Pepper Flash fullscreen. | |
1655 allow_privileged = true; | |
1656 } | 1654 } |
1657 | |
1658 DCHECK_EQ(MSG_ROUTING_NONE, fullscreen_widget_routing_id_); | |
1659 fullscreen_widget_routing_id_ = route_id; | |
1660 FOR_EACH_OBSERVER(WebContentsObserver, | 1655 FOR_EACH_OBSERVER(WebContentsObserver, |
1661 observers_, | 1656 observers_, |
1662 DidShowFullscreenWidget(route_id)); | 1657 DidShowFullscreenWidget(route_id)); |
1663 if (!widget_host_view->HasFocus()) | 1658 if (!widget_host_view->HasFocus()) |
1664 widget_host_view->Focus(); | 1659 widget_host_view->Focus(); |
1665 } else { | 1660 } else { |
1666 widget_host_view->InitAsPopup(GetRenderWidgetHostViewPort(), initial_pos); | 1661 widget_host_view->InitAsPopup(GetRenderWidgetHostViewPort(), initial_pos); |
1667 } | 1662 } |
1668 | 1663 |
1669 RenderWidgetHostImpl* render_widget_host_impl = | 1664 RenderWidgetHostImpl* render_widget_host_impl = |
1670 RenderWidgetHostImpl::From(widget_host_view->GetRenderWidgetHost()); | 1665 RenderWidgetHostImpl::From(widget_host_view->GetRenderWidgetHost()); |
1671 render_widget_host_impl->Init(); | 1666 render_widget_host_impl->Init(); |
1672 render_widget_host_impl->set_allow_privileged_mouse_lock(allow_privileged); | 1667 // Only allow privileged mouse lock for fullscreen render widget, which is |
1673 // TODO(miu): For now, all mouse lock requests by embedded Flash fullscreen | 1668 // used to implement Pepper Flash fullscreen. |
1674 // will be denied. This is to be rectified in a soon-upcoming change. | 1669 render_widget_host_impl->set_allow_privileged_mouse_lock(is_fullscreen); |
1675 | 1670 |
1676 #if defined(OS_MACOSX) | 1671 #if defined(OS_MACOSX) |
1677 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's | 1672 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's |
1678 // properly embedded (or purposefully ignored) we can release the retain we | 1673 // properly embedded (or purposefully ignored) we can release the retain we |
1679 // took in CreateNewWidget(). | 1674 // took in CreateNewWidget(). |
1680 base::mac::NSObjectRelease(widget_host_view->GetNativeView()); | 1675 base::mac::NSObjectRelease(widget_host_view->GetNativeView()); |
1681 #endif | 1676 #endif |
1682 } | 1677 } |
1683 | 1678 |
1684 WebContentsImpl* WebContentsImpl::GetCreatedWindow(int route_id) { | 1679 WebContentsImpl* WebContentsImpl::GetCreatedWindow(int route_id) { |
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3834 } | 3829 } |
3835 | 3830 |
3836 void WebContentsImpl::OnFrameRemoved( | 3831 void WebContentsImpl::OnFrameRemoved( |
3837 RenderViewHostImpl* render_view_host, | 3832 RenderViewHostImpl* render_view_host, |
3838 int64 frame_id) { | 3833 int64 frame_id) { |
3839 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3834 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3840 FrameDetached(render_view_host, frame_id)); | 3835 FrameDetached(render_view_host, frame_id)); |
3841 } | 3836 } |
3842 | 3837 |
3843 } // namespace content | 3838 } // namespace content |
OLD | NEW |