| 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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 void WebContentsImpl::ReplicatePageFocus(bool is_focused) { | 1583 void WebContentsImpl::ReplicatePageFocus(bool is_focused) { |
| 1584 // Focus loss may occur while this WebContents is being destroyed. Don't | 1584 // Focus loss may occur while this WebContents is being destroyed. Don't |
| 1585 // send the message in this case, as the main frame's RenderFrameHost and | 1585 // send the message in this case, as the main frame's RenderFrameHost and |
| 1586 // other state has already been cleared. | 1586 // other state has already been cleared. |
| 1587 if (is_being_destroyed_) | 1587 if (is_being_destroyed_) |
| 1588 return; | 1588 return; |
| 1589 | 1589 |
| 1590 frame_tree_.ReplicatePageFocus(is_focused); | 1590 frame_tree_.ReplicatePageFocus(is_focused); |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost() { | |
| 1594 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) | |
| 1595 return GetMainFrame()->GetRenderWidgetHost(); | |
| 1596 | |
| 1597 FrameTreeNode* focused_frame = frame_tree_.GetFocusedFrame(); | |
| 1598 if (!focused_frame) | |
| 1599 return GetMainFrame()->GetRenderWidgetHost(); | |
| 1600 | |
| 1601 return RenderWidgetHostImpl::From( | |
| 1602 focused_frame->current_frame_host()->GetView()->GetRenderWidgetHost()); | |
| 1603 } | |
| 1604 | |
| 1605 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { | 1593 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { |
| 1606 // This method is being called to enter renderer-initiated fullscreen mode. | 1594 // This method is being called to enter renderer-initiated fullscreen mode. |
| 1607 // Make sure any existing fullscreen widget is shut down first. | 1595 // Make sure any existing fullscreen widget is shut down first. |
| 1608 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 1596 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
| 1609 if (widget_view) | 1597 if (widget_view) |
| 1610 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown(); | 1598 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown(); |
| 1611 | 1599 |
| 1612 if (delegate_) | 1600 if (delegate_) |
| 1613 delegate_->EnterFullscreenModeForTab(this, origin); | 1601 delegate_->EnterFullscreenModeForTab(this, origin); |
| 1614 | 1602 |
| (...skipping 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4662 return NULL; | 4650 return NULL; |
| 4663 } | 4651 } |
| 4664 | 4652 |
| 4665 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4653 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4666 force_disable_overscroll_content_ = force_disable; | 4654 force_disable_overscroll_content_ = force_disable; |
| 4667 if (view_) | 4655 if (view_) |
| 4668 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4656 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4669 } | 4657 } |
| 4670 | 4658 |
| 4671 } // namespace content | 4659 } // namespace content |
| OLD | NEW |