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

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

Issue 13966012: Revert 195553 "Allow showing pending URL for new tab navigations..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 const NavigationControllerImpl& WebContentsImpl::GetController() const { 707 const NavigationControllerImpl& WebContentsImpl::GetController() const {
708 return controller_; 708 return controller_;
709 } 709 }
710 710
711 BrowserContext* WebContentsImpl::GetBrowserContext() const { 711 BrowserContext* WebContentsImpl::GetBrowserContext() const {
712 return controller_.GetBrowserContext(); 712 return controller_.GetBrowserContext();
713 } 713 }
714 714
715 const GURL& WebContentsImpl::GetURL() const { 715 const GURL& WebContentsImpl::GetURL() const {
716 // We may not have a navigation entry yet 716 // We may not have a navigation entry yet
717 NavigationEntry* entry = controller_.GetVisibleEntry(); 717 NavigationEntry* entry = controller_.GetActiveEntry();
718 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); 718 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL();
719 } 719 }
720 720
721 WebContentsDelegate* WebContentsImpl::GetDelegate() { 721 WebContentsDelegate* WebContentsImpl::GetDelegate() {
722 return delegate_; 722 return delegate_;
723 } 723 }
724 724
725 void WebContentsImpl::SetDelegate(WebContentsDelegate* delegate) { 725 void WebContentsImpl::SetDelegate(WebContentsDelegate* delegate) {
726 // TODO(cbentzel): remove this debugging code? 726 // TODO(cbentzel): remove this debugging code?
727 if (delegate == delegate_) 727 if (delegate == delegate_)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 std::string accept_languages = 853 std::string accept_languages =
854 GetContentClient()->browser()->GetAcceptLangs( 854 GetContentClient()->browser()->GetAcceptLangs(
855 GetBrowserContext()); 855 GetBrowserContext());
856 if (entry) { 856 if (entry) {
857 return entry->GetTitleForDisplay(accept_languages); 857 return entry->GetTitleForDisplay(accept_languages);
858 } 858 }
859 WebUI* our_web_ui = render_manager_.pending_web_ui() ? 859 WebUI* our_web_ui = render_manager_.pending_web_ui() ?
860 render_manager_.pending_web_ui() : render_manager_.web_ui(); 860 render_manager_.pending_web_ui() : render_manager_.web_ui();
861 if (our_web_ui) { 861 if (our_web_ui) {
862 // Don't override the title in view source mode. 862 // Don't override the title in view source mode.
863 entry = controller_.GetVisibleEntry(); 863 entry = controller_.GetActiveEntry();
864 if (!(entry && entry->IsViewSourceMode())) { 864 if (!(entry && entry->IsViewSourceMode())) {
865 // Give the Web UI the chance to override our title. 865 // Give the Web UI the chance to override our title.
866 const string16& title = our_web_ui->GetOverriddenTitle(); 866 const string16& title = our_web_ui->GetOverriddenTitle();
867 if (!title.empty()) 867 if (!title.empty())
868 return title; 868 return title;
869 } 869 }
870 } 870 }
871 871
872 // We use the title for the last committed entry rather than a pending 872 // We use the title for the last committed entry rather than a pending
873 // navigation entry. For example, when the user types in a URL, we want to 873 // navigation entry. For example, when the user types in a URL, we want to
874 // keep the old page's title until the new load has committed and we get a new 874 // keep the old page's title until the new load has committed and we get a new
875 // title. 875 // title.
876 entry = controller_.GetLastCommittedEntry(); 876 entry = controller_.GetLastCommittedEntry();
877
878 // We make an exception for initial navigations, because we can have a
879 // committed entry for an initial navigation when doing a history navigation
880 // in a new tab, such as Ctrl+Back.
881 if (entry && controller_.IsInitialNavigation())
882 entry = controller_.GetVisibleEntry();
883
884 if (entry) { 877 if (entry) {
885 return entry->GetTitleForDisplay(accept_languages); 878 return entry->GetTitleForDisplay(accept_languages);
886 } 879 }
887 880
888 // |page_title_when_no_navigation_entry_| is finally used 881 // |page_title_when_no_navigation_entry_| is finally used
889 // if no title cannot be retrieved. 882 // if no title cannot be retrieved.
890 return page_title_when_no_navigation_entry_; 883 return page_title_when_no_navigation_entry_;
891 } 884 }
892 885
893 int32 WebContentsImpl::GetMaxPageID() { 886 int32 WebContentsImpl::GetMaxPageID() {
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 bool is_error_page = (url.spec() == kUnreachableWebDataURL); 1969 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
1977 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL); 1970 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL);
1978 GURL validated_url(url); 1971 GURL validated_url(url);
1979 RenderProcessHost* render_process_host = 1972 RenderProcessHost* render_process_host =
1980 render_view_host->GetProcess(); 1973 render_view_host->GetProcess();
1981 RenderViewHost::FilterURL(render_process_host, false, &validated_url); 1974 RenderViewHost::FilterURL(render_process_host, false, &validated_url);
1982 1975
1983 if (is_main_frame) 1976 if (is_main_frame)
1984 DidChangeLoadProgress(0); 1977 DidChangeLoadProgress(0);
1985 1978
1986 // Create a pending entry for this provisional load (if none exists) using the
1987 // current SiteInstance, and ensure the address bar updates accordingly.
1988 // We don't know the referrer or extra headers at this point, but the referrer
1989 // will be set properly upon commit.
1990 if (is_main_frame && !controller_.GetPendingEntry()) {
1991 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
1992 controller_.CreateNavigationEntry(validated_url,
1993 content::Referrer(),
1994 content::PAGE_TRANSITION_LINK,
1995 true /* is_renderer_initiated */,
1996 std::string(), GetBrowserContext()));
1997 entry->set_site_instance(
1998 static_cast<SiteInstanceImpl*>(GetSiteInstance()));
1999 controller_.SetPendingEntry(entry);
2000 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL);
2001 }
2002
2003 // Notify observers about the start of the provisional load. 1979 // Notify observers about the start of the provisional load.
2004 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 1980 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2005 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id, 1981 DidStartProvisionalLoadForFrame(frame_id, parent_frame_id,
2006 is_main_frame, validated_url, is_error_page, 1982 is_main_frame, validated_url, is_error_page,
2007 is_iframe_srcdoc, render_view_host)); 1983 is_iframe_srcdoc, render_view_host));
2008 1984
2009 if (is_main_frame) { 1985 if (is_main_frame) {
2010 // Notify observers about the provisional change in the main frame URL. 1986 // Notify observers about the provisional change in the main frame URL.
2011 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 1987 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2012 ProvisionalChangeToMainFrameUrl(validated_url, 1988 ProvisionalChangeToMainFrameUrl(validated_url,
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 Source<WebContents>(opener_)); 2904 Source<WebContents>(opener_));
2929 opener_ = NULL; 2905 opener_ = NULL;
2930 } 2906 }
2931 2907
2932 // Notify all swapped out RenderViewHosts for this tab. This is important 2908 // Notify all swapped out RenderViewHosts for this tab. This is important
2933 // in case we go back to them, or if another window in those processes tries 2909 // in case we go back to them, or if another window in those processes tries
2934 // to access window.opener. 2910 // to access window.opener.
2935 render_manager_.DidDisownOpener(rvh); 2911 render_manager_.DidDisownOpener(rvh);
2936 } 2912 }
2937 2913
2938 void WebContentsImpl::DidAccessInitialDocument() {
2939 // Update the URL display.
2940 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL);
2941 }
2942
2943 void WebContentsImpl::DocumentAvailableInMainFrame( 2914 void WebContentsImpl::DocumentAvailableInMainFrame(
2944 RenderViewHost* render_view_host) { 2915 RenderViewHost* render_view_host) {
2945 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2916 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2946 DocumentAvailableInMainFrame()); 2917 DocumentAvailableInMainFrame());
2947 } 2918 }
2948 2919
2949 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame( 2920 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame(
2950 RenderViewHost* render_view_host, 2921 RenderViewHost* render_view_host,
2951 int32 page_id) { 2922 int32 page_id) {
2952 NotificationService::current()->Notify( 2923 NotificationService::current()->Notify(
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
3438 } 3409 }
3439 3410
3440 BrowserPluginGuestManager* 3411 BrowserPluginGuestManager*
3441 WebContentsImpl::GetBrowserPluginGuestManager() const { 3412 WebContentsImpl::GetBrowserPluginGuestManager() const {
3442 return static_cast<BrowserPluginGuestManager*>( 3413 return static_cast<BrowserPluginGuestManager*>(
3443 GetBrowserContext()->GetUserData( 3414 GetBrowserContext()->GetUserData(
3444 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3415 browser_plugin::kBrowserPluginGuestManagerKeyName));
3445 } 3416 }
3446 3417
3447 } // namespace content 3418 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/browser/web_contents/web_contents_impl.h ('k') | trunk/src/content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698