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

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: Make it a uitest. 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 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. 2913 // Resume blocked requests for both the RenderViewHost and RenderFrameHost.
2914 // TODO(brettw): It seems bogus to reach into here and initialize the host. 2914 // TODO(brettw): It seems bogus to reach into here and initialize the host.
2915 if (is_resume_pending_) { 2915 if (is_resume_pending_) {
2916 is_resume_pending_ = false; 2916 is_resume_pending_ = false;
2917 GetRenderViewHost()->GetWidget()->Init(); 2917 GetRenderViewHost()->GetWidget()->Init();
2918 GetMainFrame()->Init(); 2918 GetMainFrame()->Init();
2919 } 2919 }
2920 } 2920 }
2921 2921
2922 bool WebContentsImpl::FocusLocationBarByDefault() { 2922 bool WebContentsImpl::FocusLocationBarByDefault() {
2923 NavigationEntry* entry = controller_.GetVisibleEntry(); 2923 // If we are starting at about:blank, give the omnibox focus to let the user
2924 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) 2924 // easily edit it. We intentionally check the pending entry rather than the
2925 // visible one, since we don't want to be tricked by non-visible pending URLs.
2926 // See https://crbug.com/567445.
2927 NavigationEntryImpl* entry = controller_.GetPendingEntry();
2928 if (controller_.IsInitialNavigation() && entry &&
2929 !entry->is_renderer_initiated() &&
2930 entry->GetURL() == GURL(url::kAboutBlankURL)) {
2925 return true; 2931 return true;
2932 }
2926 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); 2933 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this);
2927 } 2934 }
2928 2935
2929 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { 2936 void WebContentsImpl::SetFocusToLocationBar(bool select_all) {
2930 if (delegate_) 2937 if (delegate_)
2931 delegate_->SetFocusToLocationBar(select_all); 2938 delegate_->SetFocusToLocationBar(select_all);
2932 } 2939 }
2933 2940
2934 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) { 2941 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) {
2935 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2942 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
4758 const WebContentsObserver::MediaPlayerId& id) { 4765 const WebContentsObserver::MediaPlayerId& id) {
4759 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4766 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4760 } 4767 }
4761 4768
4762 void WebContentsImpl::MediaStoppedPlaying( 4769 void WebContentsImpl::MediaStoppedPlaying(
4763 const WebContentsObserver::MediaPlayerId& id) { 4770 const WebContentsObserver::MediaPlayerId& id) {
4764 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4771 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4765 } 4772 }
4766 4773
4767 } // namespace content 4774 } // 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