Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1276)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1505723005: Null-check GetView before using it in GetFocusedRenderWidgetHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 1640
1641 // Events for widgets other than the main frame (e.g., popup menus) should be 1641 // Events for widgets other than the main frame (e.g., popup menus) should be
1642 // forwarded directly to the widget they arrived on. 1642 // forwarded directly to the widget they arrived on.
1643 if (receiving_widget != GetMainFrame()->GetRenderWidgetHost()) 1643 if (receiving_widget != GetMainFrame()->GetRenderWidgetHost())
1644 return receiving_widget; 1644 return receiving_widget;
1645 1645
1646 FrameTreeNode* focused_frame = frame_tree_.GetFocusedFrame(); 1646 FrameTreeNode* focused_frame = frame_tree_.GetFocusedFrame();
1647 if (!focused_frame) 1647 if (!focused_frame)
1648 return receiving_widget; 1648 return receiving_widget;
1649 1649
1650 return RenderWidgetHostImpl::From( 1650 // The view may be null if a subframe's renderer process has crashed while
1651 focused_frame->current_frame_host()->GetView()->GetRenderWidgetHost()); 1651 // the subframe has focus. Give the event to the main frame in this case.
Charlie Reis 2015/12/07 22:47:24 Sanity check: What will the main frame do with it?
alexmos 2015/12/07 23:12:59 That's a good point. It's going to go to the main
Charlie Reis 2015/12/07 23:16:52 Yes, let's do that. Thanks!
alexmos 2015/12/07 23:21:50 Done. Please take a look.
1652 RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView();
1653 if (!view)
1654 return receiving_widget;
1655
1656 return RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
1652 } 1657 }
1653 1658
1654 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { 1659 void WebContentsImpl::EnterFullscreenMode(const GURL& origin) {
1655 // This method is being called to enter renderer-initiated fullscreen mode. 1660 // This method is being called to enter renderer-initiated fullscreen mode.
1656 // Make sure any existing fullscreen widget is shut down first. 1661 // Make sure any existing fullscreen widget is shut down first.
1657 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); 1662 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView();
1658 if (widget_view) 1663 if (widget_view)
1659 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown(); 1664 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown();
1660 1665
1661 if (delegate_) 1666 if (delegate_)
(...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 return NULL; 4811 return NULL;
4807 } 4812 }
4808 4813
4809 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4814 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4810 force_disable_overscroll_content_ = force_disable; 4815 force_disable_overscroll_content_ = force_disable;
4811 if (view_) 4816 if (view_)
4812 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4817 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4813 } 4818 }
4814 4819
4815 } // namespace content 4820 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698