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 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 // the subframe has focus. Drop the event in that case. Do not give | 1663 // the subframe has focus. Drop the event in that case. Do not give |
1664 // it to the main frame, so that the user doesn't unexpectedly type into the | 1664 // it to the main frame, so that the user doesn't unexpectedly type into the |
1665 // wrong frame if a focused subframe renderer crashes while they type. | 1665 // wrong frame if a focused subframe renderer crashes while they type. |
1666 RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView(); | 1666 RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView(); |
1667 if (!view) | 1667 if (!view) |
1668 return nullptr; | 1668 return nullptr; |
1669 | 1669 |
1670 return RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); | 1670 return RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); |
1671 } | 1671 } |
1672 | 1672 |
| 1673 RenderWidgetHostViewBase* WebContentsImpl::GetFocusedView() { |
| 1674 FrameTreeNode* focused_frame = frame_tree_.GetFocusedFrame(); |
| 1675 if (!focused_frame) |
| 1676 return nullptr; |
| 1677 |
| 1678 return static_cast<RenderWidgetHostViewBase*>( |
| 1679 focused_frame->current_frame_host()->GetView()); |
| 1680 } |
| 1681 |
1673 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { | 1682 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { |
1674 // This method is being called to enter renderer-initiated fullscreen mode. | 1683 // This method is being called to enter renderer-initiated fullscreen mode. |
1675 // Make sure any existing fullscreen widget is shut down first. | 1684 // Make sure any existing fullscreen widget is shut down first. |
1676 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 1685 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
1677 if (widget_view) { | 1686 if (widget_view) { |
1678 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) | 1687 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) |
1679 ->ShutdownAndDestroyWidget(true); | 1688 ->ShutdownAndDestroyWidget(true); |
1680 } | 1689 } |
1681 | 1690 |
1682 if (delegate_) | 1691 if (delegate_) |
(...skipping 3139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4822 else | 4831 else |
4823 WasHidden(); | 4832 WasHidden(); |
4824 } | 4833 } |
4825 | 4834 |
4826 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4835 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
4827 JavaScriptDialogManager* dialog_manager) { | 4836 JavaScriptDialogManager* dialog_manager) { |
4828 dialog_manager_ = dialog_manager; | 4837 dialog_manager_ = dialog_manager; |
4829 } | 4838 } |
4830 | 4839 |
4831 } // namespace content | 4840 } // namespace content |
OLD | NEW |