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 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1664 // the subframe has focus. Drop the event in that case. Do not give | 1664 // the subframe has focus. Drop the event in that case. Do not give |
1665 // it to the main frame, so that the user doesn't unexpectedly type into the | 1665 // it to the main frame, so that the user doesn't unexpectedly type into the |
1666 // wrong frame if a focused subframe renderer crashes while they type. | 1666 // wrong frame if a focused subframe renderer crashes while they type. |
1667 RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView(); | 1667 RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView(); |
1668 if (!view) | 1668 if (!view) |
1669 return nullptr; | 1669 return nullptr; |
1670 | 1670 |
1671 return RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); | 1671 return RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); |
1672 } | 1672 } |
1673 | 1673 |
1674 RenderWidgetHostViewBase* WebContentsImpl::GetFocusedView() { | |
1675 FrameTreeNode* focused_frame = frame_tree_.GetFocusedFrame(); | |
1676 if (!focused_frame) | |
1677 return nullptr; | |
1678 | |
1679 RenderFrameHostImpl* rfhi = focused_frame->current_frame_host(); | |
1680 if (rfhi->GetRenderWidgetHost()) | |
1681 return rfhi->GetRenderWidgetHost()->GetView(); | |
1682 else if (rfhi->GetRenderViewHost()) | |
Charlie Reis
2016/02/17 06:22:14
nit: No else needed after return.
Also, this look
kenrb
2016/02/17 23:05:53
I hadn't noticed this, but right. I think everythi
EhsanK
2016/02/18 05:48:01
Yes this is the correct way. Thanks!
EhsanK
2016/02/18 05:48:01
I guess using RFH::GetView() resolves all the issu
| |
1683 return RenderWidgetHostImpl::From(rfhi->GetRenderViewHost()->GetWidget()) | |
1684 ->GetView(); | |
1685 | |
1686 NOTREACHED(); | |
1687 return nullptr; | |
1688 } | |
1689 | |
1674 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { | 1690 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { |
1675 // This method is being called to enter renderer-initiated fullscreen mode. | 1691 // This method is being called to enter renderer-initiated fullscreen mode. |
1676 // Make sure any existing fullscreen widget is shut down first. | 1692 // Make sure any existing fullscreen widget is shut down first. |
1677 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 1693 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
1678 if (widget_view) { | 1694 if (widget_view) { |
1679 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) | 1695 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) |
1680 ->ShutdownAndDestroyWidget(true); | 1696 ->ShutdownAndDestroyWidget(true); |
1681 } | 1697 } |
1682 | 1698 |
1683 if (delegate_) | 1699 if (delegate_) |
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4751 const WebContentsObserver::MediaPlayerId& id) { | 4767 const WebContentsObserver::MediaPlayerId& id) { |
4752 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4768 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
4753 } | 4769 } |
4754 | 4770 |
4755 void WebContentsImpl::MediaStoppedPlaying( | 4771 void WebContentsImpl::MediaStoppedPlaying( |
4756 const WebContentsObserver::MediaPlayerId& id) { | 4772 const WebContentsObserver::MediaPlayerId& id) { |
4757 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4773 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
4758 } | 4774 } |
4759 | 4775 |
4760 } // namespace content | 4776 } // namespace content |
OLD | NEW |