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

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: Test in chrome/. 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 2895 matching lines...) Expand 10 before | Expand all | Expand 10 after
2906 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. 2906 // Resume blocked requests for both the RenderViewHost and RenderFrameHost.
2907 // TODO(brettw): It seems bogus to reach into here and initialize the host. 2907 // TODO(brettw): It seems bogus to reach into here and initialize the host.
2908 if (is_resume_pending_) { 2908 if (is_resume_pending_) {
2909 is_resume_pending_ = false; 2909 is_resume_pending_ = false;
2910 GetRenderViewHost()->GetWidget()->Init(); 2910 GetRenderViewHost()->GetWidget()->Init();
2911 GetMainFrame()->Init(); 2911 GetMainFrame()->Init();
2912 } 2912 }
2913 } 2913 }
2914 2914
2915 bool WebContentsImpl::FocusLocationBarByDefault() { 2915 bool WebContentsImpl::FocusLocationBarByDefault() {
2916 NavigationEntry* entry = controller_.GetVisibleEntry(); 2916 // If we are starting at about:blank, give the omnibox focus to let the user
2917 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) 2917 // easily edit it. We intentionally check the pending entry rather than the
2918 // visible one, since we don't want to be tricked by non-visible pending URLs.
2919 // See https://crbug.com/567445.
2920 NavigationEntryImpl* entry = controller_.GetPendingEntry();
2921 if (controller_.IsInitialNavigation() && entry &&
2922 !entry->is_renderer_initiated() &&
2923 entry->GetURL() == GURL(url::kAboutBlankURL)) {
2918 return true; 2924 return true;
2925 }
2919 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); 2926 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this);
2920 } 2927 }
2921 2928
2922 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { 2929 void WebContentsImpl::SetFocusToLocationBar(bool select_all) {
2923 if (delegate_) 2930 if (delegate_)
2924 delegate_->SetFocusToLocationBar(select_all); 2931 delegate_->SetFocusToLocationBar(select_all);
2925 } 2932 }
2926 2933
2927 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) { 2934 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) {
2928 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2935 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 const WebContentsObserver::MediaPlayerId& id) { 4758 const WebContentsObserver::MediaPlayerId& id) {
4752 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4759 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4753 } 4760 }
4754 4761
4755 void WebContentsImpl::MediaStoppedPlaying( 4762 void WebContentsImpl::MediaStoppedPlaying(
4756 const WebContentsObserver::MediaPlayerId& id) { 4763 const WebContentsObserver::MediaPlayerId& id) {
4757 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4764 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4758 } 4765 }
4759 4766
4760 } // namespace content 4767 } // namespace content
OLDNEW
« chrome/browser/ui/browser_navigator_browsertest.cc ('K') | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698