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

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

Issue 1678233003: Don't focus the location bar in a phishy situation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait for load in the WC returned by GetActiveWebContents Created 4 years, 10 months 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. 2925 // Resume blocked requests for both the RenderViewHost and RenderFrameHost.
2926 // TODO(brettw): It seems bogus to reach into here and initialize the host. 2926 // TODO(brettw): It seems bogus to reach into here and initialize the host.
2927 if (is_resume_pending_) { 2927 if (is_resume_pending_) {
2928 is_resume_pending_ = false; 2928 is_resume_pending_ = false;
2929 GetRenderViewHost()->GetWidget()->Init(); 2929 GetRenderViewHost()->GetWidget()->Init();
2930 GetMainFrame()->Init(); 2930 GetMainFrame()->Init();
2931 } 2931 }
2932 } 2932 }
2933 2933
2934 bool WebContentsImpl::FocusLocationBarByDefault() { 2934 bool WebContentsImpl::FocusLocationBarByDefault() {
2935 NavigationEntry* entry = controller_.GetVisibleEntry(); 2935 // If we are starting at about:blank, give the omnibox focus to let the user
2936 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) 2936 // easily edit it. We intentionally check the pending entry rather than the
2937 // visible one, since we don't want to be tricked by non-visible pending URLs.
2938 // See https://crbug.com/567445.
Peter Kasting 2016/03/03 21:02:19 Nit: I'd prefer to explain sufficiently inline tha
palmer 2016/03/04 22:15:57 Done.
2939 NavigationEntryImpl* entry = controller_.GetPendingEntry();
2940 if (controller_.IsInitialNavigation() && entry &&
2941 !entry->is_renderer_initiated() &&
2942 entry->GetURL() == GURL(url::kAboutBlankURL)) {
2937 return true; 2943 return true;
2944 }
2938 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); 2945 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this);
2939 } 2946 }
2940 2947
2941 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { 2948 void WebContentsImpl::SetFocusToLocationBar(bool select_all) {
2942 if (delegate_) 2949 if (delegate_)
2943 delegate_->SetFocusToLocationBar(select_all); 2950 delegate_->SetFocusToLocationBar(select_all);
2944 } 2951 }
2945 2952
2946 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) { 2953 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) {
2947 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2954 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
4786 const WebContentsObserver::MediaPlayerId& id) { 4793 const WebContentsObserver::MediaPlayerId& id) {
4787 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4794 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4788 } 4795 }
4789 4796
4790 void WebContentsImpl::MediaStoppedPlaying( 4797 void WebContentsImpl::MediaStoppedPlaying(
4791 const WebContentsObserver::MediaPlayerId& id) { 4798 const WebContentsObserver::MediaPlayerId& id) {
4792 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4799 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4793 } 4800 }
4794 4801
4795 } // namespace content 4802 } // namespace content
OLDNEW
« chrome/browser/ui/browser_focus_uitest.cc ('K') | « chrome/browser/ui/browser_focus_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698