diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 15:11:58 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 15:11:58 +0000 |
commit | bce1f1c2b86044531ebcfcb7fca44d4171cb8782 (patch) | |
tree | 18bebfaf3f2d5f1bdba9e0471901f0c423a1fbac | |
parent | 6159cc3aca4a45ee057b944a28c936c064efcd2c (diff) | |
download | chromium_src-bce1f1c2b86044531ebcfcb7fca44d4171cb8782.zip chromium_src-bce1f1c2b86044531ebcfcb7fca44d4171cb8782.tar.gz chromium_src-bce1f1c2b86044531ebcfcb7fca44d4171cb8782.tar.bz2 |
Replace the GURL referrer field of OpenURLParams with a content::Referrer
BUG=105028
TEST=none (no functional change)
TBR=zea@chromium.org
Review URL: http://codereview.chromium.org/8784006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112978 0039d316-1c4b-4281-b951-d872f2087c98
39 files changed, 108 insertions, 72 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 638052d8..bd3528b 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -6052,7 +6052,7 @@ void TestingAutomationProvider::NavigateToURL( &tab_contents->controller(), this, reply_message, navigation_count, false, true); browser->OpenURLFromTab(tab_contents, OpenURLParams( - GURL(url), GURL(), CURRENT_TAB, + GURL(url), content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); } diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc index f5705ba..538de7c 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc @@ -33,8 +33,9 @@ class TestingPageNavigator : public PageNavigator { const GURL& referrer, WindowOpenDisposition disposition, content::PageTransition transition) OVERRIDE { - return OpenURL(OpenURLParams(url, referrer, disposition, transition, - false)); + DCHECK(referrer.is_empty()); + return OpenURL(OpenURLParams(url, content::Referrer(), disposition, + transition, false)); } virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 3d4b806..aef0203 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -77,8 +77,9 @@ class NewBrowserPageNavigator : public PageNavigator { const GURL& referrer, WindowOpenDisposition disposition, content::PageTransition transition) OVERRIDE { - return OpenURL(OpenURLParams(url, referrer, disposition, transition, - false)); + DCHECK(referrer.is_empty()); + return OpenURL(OpenURLParams(url, content::Referrer(), disposition, + transition, false)); } virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { @@ -155,8 +156,9 @@ void OpenAllImpl(const BookmarkNode* node, disposition = NEW_BACKGROUND_TAB; else disposition = initial_disposition; - (*navigator)->OpenURL(OpenURLParams(node->url(), GURL(), disposition, - content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); + (*navigator)->OpenURL(OpenURLParams(node->url(), content::Referrer(), + disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK, + false)); if (!*opened_url) { *opened_url = true; // We opened the first URL which may have opened a new window or clobbered diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc index 65807aa..e30ab2b 100644 --- a/chrome/browser/download/download_shelf_context_menu.cc +++ b/chrome/browser/download/download_shelf_context_menu.cc @@ -111,7 +111,7 @@ void DownloadShelfContextMenu::ExecuteCommand(int command_id) { DCHECK(browser && browser->is_type_tabbed()); GURL learn_more_url(chrome::kDownloadScanningLearnMoreURL); OpenURLParams params(google_util::AppendGoogleLocaleParam(learn_more_url), - GURL(), NEW_FOREGROUND_TAB, + content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, false); browser->OpenURL(params); break; diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc index 8f4e7f5..9f7a9c0 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.cc +++ b/chrome/browser/extensions/extension_webnavigation_api.cc @@ -588,7 +588,7 @@ void ExtensionWebNavigationTabObserver::DidFinishLoad( void ExtensionWebNavigationTabObserver::DidOpenRequestedURL( TabContents* new_contents, const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition, int64 source_frame_id) { diff --git a/chrome/browser/extensions/extension_webnavigation_api.h b/chrome/browser/extensions/extension_webnavigation_api.h index e8234d0..9e641b3 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.h +++ b/chrome/browser/extensions/extension_webnavigation_api.h @@ -154,7 +154,7 @@ class ExtensionWebNavigationTabObserver : public TabContentsObserver { bool is_main_frame) OVERRIDE; virtual void DidOpenRequestedURL(TabContents* new_contents, const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition, int64 source_frame_id) OVERRIDE; diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc index a65936f..d97b8df 100644 --- a/chrome/browser/extensions/webstore_inline_installer.cc +++ b/chrome/browser/extensions/webstore_inline_installer.cc @@ -238,7 +238,8 @@ void WebstoreInlineInstaller::OnWebstoreResponseParseSuccess( tab_contents()->OpenURL(OpenURLParams( GURL(redirect_url), - tab_contents()->GetURL(), + content::Referrer(tab_contents()->GetURL(), + WebKit::WebReferrerPolicyDefault), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 5e5d6f1..e08b3b9 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -51,6 +51,10 @@ #include "content/public/common/page_zoom.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/menu_model.h" #include "ui/base/resource/resource_bundle.h" @@ -59,6 +63,10 @@ using content::BrowserThread; using ui::ViewProp; +using WebKit::WebCString; +using WebKit::WebString; +using WebKit::WebReferrerPolicy; +using WebKit::WebSecurityPolicy; static const char kWindowObjectKey[] = "ChromeWindowObject"; @@ -347,18 +355,21 @@ TabContents* ExternalTabContainer::OpenURLFromTab(TabContents* source, case NEW_WINDOW: case SAVE_TO_DISK: if (automation_) { + GURL referrer = GURL(WebSecurityPolicy::generateReferrerHeader( + params.referrer.policy, + params.url, + WebString::fromUTF8(params.referrer.url.spec())).utf8()); automation_->Send(new AutomationMsg_OpenURL(tab_handle_, params.url, - params.referrer, + referrer, params.disposition)); // TODO(ananta) // We should populate other fields in the // ViewHostMsg_FrameNavigate_Params structure. Another option could be // to refactor the UpdateHistoryForNavigation function in TabContents. content::FrameNavigateParams nav_params; - nav_params.referrer = content::Referrer( - params.referrer, - WebKit::WebReferrerPolicyDefault); + nav_params.referrer = content::Referrer(referrer, + params.referrer.policy); nav_params.url = params.url; nav_params.page_id = -1; nav_params.transition = content::PAGE_TRANSITION_LINK; diff --git a/chrome/browser/oom_priority_manager_browsertest.cc b/chrome/browser/oom_priority_manager_browsertest.cc index 04e6f1d..a2b5f76 100644 --- a/chrome/browser/oom_priority_manager_browsertest.cc +++ b/chrome/browser/oom_priority_manager_browsertest.cc @@ -24,14 +24,14 @@ IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { WindowedNotificationObserver load1( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); - OpenURLParams open1(GURL("chrome://about"), GURL(), + OpenURLParams open1(GURL("chrome://about"), content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); browser()->OpenURL(open1); WindowedNotificationObserver load2( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); - OpenURLParams open2(GURL("chrome://credits"), GURL(), + OpenURLParams open2(GURL("chrome://credits"), content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, false); browser()->OpenURL(open2); @@ -39,7 +39,7 @@ IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { WindowedNotificationObserver load3( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); - OpenURLParams open3(GURL("chrome://terms"), GURL(), + OpenURLParams open3(GURL("chrome://terms"), content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, false); browser()->OpenURL(open3); diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc index cc9f3c9..b01c083 100644 --- a/chrome/browser/plugin_observer.cc +++ b/chrome/browser/plugin_observer.cc @@ -351,7 +351,9 @@ void PluginObserver::DidNotFindMissingPlugin(int placeholder_id, void PluginObserver::InstallMissingPlugin(PluginInstaller* installer) { if (installer->url_for_display()) { tab_contents()->OpenURL(OpenURLParams( - installer->plugin_url(), tab_contents()->GetURL(), + installer->plugin_url(), + content::Referrer(tab_contents()->GetURL(), + WebKit::WebReferrerPolicyDefault), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, false)); } else { NOTIMPLEMENTED(); diff --git a/chrome/browser/renderer_host/transfer_navigation_resource_handler.cc b/chrome/browser/renderer_host/transfer_navigation_resource_handler.cc index e0e80ad..cbbfd9f 100644 --- a/chrome/browser/renderer_host/transfer_navigation_resource_handler.cc +++ b/chrome/browser/renderer_host/transfer_navigation_resource_handler.cc @@ -11,6 +11,7 @@ #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" +#include "content/public/common/referrer.h" namespace { @@ -65,8 +66,9 @@ void RequestTransferURLOnUIThread(int render_process_id, if (!delegate) return; - delegate->RequestTransferURL(new_url, referrer, window_open_disposition, - frame_id, request_id); + delegate->RequestTransferURL( + new_url, content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), + window_open_disposition, frame_id, request_id); } } // namespace diff --git a/chrome/browser/sync/test/integration/performance/sessions_sync_perf_test.cc b/chrome/browser/sync/test/integration/performance/sessions_sync_perf_test.cc index 74e0a9d..7e808b3 100644 --- a/chrome/browser/sync/test/integration/performance/sessions_sync_perf_test.cc +++ b/chrome/browser/sync/test/integration/performance/sessions_sync_perf_test.cc @@ -62,7 +62,10 @@ void SessionsSyncPerfTest::UpdateTabs(int profile) { browser->SelectNumberedTab(i); url = NextURL(); browser->OpenURL( - OpenURLParams(url, GURL("http://localhost"), CURRENT_TAB, + OpenURLParams(url, + content::Referrer(GURL("http://localhost"), + WebKit::WebReferrerPolicyDefault), + CURRENT_TAB, content::PageTransitionFromInt(0), false)); urls.push_back(url); } diff --git a/chrome/browser/tab_contents/insecure_content_infobar_delegate.cc b/chrome/browser/tab_contents/insecure_content_infobar_delegate.cc index a74b5a0..9c3be0a 100644 --- a/chrome/browser/tab_contents/insecure_content_infobar_delegate.cc +++ b/chrome/browser/tab_contents/insecure_content_infobar_delegate.cc @@ -81,7 +81,8 @@ bool InsecureContentInfoBarDelegate::LinkClicked( owner()->tab_contents()->OpenURL(OpenURLParams( google_util::AppendGoogleLocaleParam(GURL( "https://www.google.com/support/chrome/bin/answer.py?answer=1342714")), - GURL(), (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, + content::Referrer(), + (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, content::PAGE_TRANSITION_LINK, false)); return false; } diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 818ee48..0725e56 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -1804,7 +1804,8 @@ void RenderViewContextMenu::OpenURL( WindowOpenDisposition disposition, content::PageTransition transition) { TabContents* new_contents = source_tab_contents_->OpenURL(OpenURLParams( - url, referrer, disposition, transition, false)); + url, content::Referrer(referrer, params_.referrer_policy), disposition, + transition, false)); if (new_contents) { content::RetargetingDetails details; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index c15d98d..4e81a7c 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -769,8 +769,11 @@ TabContents* Browser::OpenApplicationTab(Profile* profile, TabStripModel* model = browser->tabstrip_model(); int tab_index = model->GetWrapperIndex(existing_tab); - existing_tab->OpenURL(OpenURLParams(extension_url, existing_tab->GetURL(), - disposition, content::PAGE_TRANSITION_LINK, false)); + existing_tab->OpenURL(OpenURLParams( + extension_url, + content::Referrer(existing_tab->GetURL(), + WebKit::WebReferrerPolicyDefault), + disposition, content::PAGE_TRANSITION_LINK, false)); if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) { model->SetTabPinned(tab_index, true); tab_index = model->GetWrapperIndex(existing_tab); @@ -2969,8 +2972,8 @@ TabContents* Browser::OpenURL(const GURL& url, content::PageTransition transition) { // For specifying a referrer, use the version of OpenURL taking OpenURLParams. DCHECK(referrer.is_empty()); - return OpenURLFromTab(NULL, OpenURLParams(url, referrer, disposition, - transition, false)); + return OpenURLFromTab(NULL, OpenURLParams( + url, content::Referrer(), disposition, transition, false)); } TabContents* Browser::OpenURL(const OpenURLParams& params) { @@ -3385,7 +3388,7 @@ TabContents* Browser::OpenURLFromTab(TabContents* source, nav_params.source_contents = tabstrip_model()->GetTabContentsAt( tabstrip_model()->GetWrapperIndex(source)); - nav_params.referrer = params.referrer; + nav_params.referrer = params.referrer.url; nav_params.disposition = params.disposition; nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index ab39621..888e6ca 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -215,7 +215,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { const GURL& previousURL = entry->virtual_url(); tabContents_->tab_contents()->OpenURL(OpenURLParams( url, - previousURL, + content::Referrer(previousURL, WebKit::WebReferrerPolicyDefault), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); diff --git a/chrome/browser/ui/gtk/about_chrome_dialog.cc b/chrome/browser/ui/gtk/about_chrome_dialog.cc index 68e4ea7..1a56274 100644 --- a/chrome/browser/ui/gtk/about_chrome_dialog.cc +++ b/chrome/browser/ui/gtk/about_chrome_dialog.cc @@ -68,7 +68,8 @@ GtkWidget* MakeMarkupLabel(const char* format, const std::string& str) { void OnLinkButtonClick(GtkWidget* button, const char* url) { BrowserList::GetLastActive()->OpenURL(OpenURLParams( - GURL(url), GURL(), NEW_WINDOW, content::PAGE_TRANSITION_LINK, false)); + GURL(url), content::Referrer(), NEW_WINDOW, content::PAGE_TRANSITION_LINK, + false)); } const char* GetChromiumUrl() { diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc index d280353..6a7515c 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc @@ -130,7 +130,7 @@ void BookmarkMenuController::NavigateToMenuItem( DCHECK(node); DCHECK(page_navigator_); page_navigator_->OpenURL(OpenURLParams( - node->url(), GURL(), disposition, + node->url(), content::Referrer(), disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc index 777840a..cd23414 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc @@ -100,7 +100,7 @@ void BookmarkNodeMenuModel::NavigateToMenuItem( const BookmarkNode* node = node_->GetChild(index); DCHECK(node); page_navigator_->OpenURL(OpenURLParams( - node->url(), GURL(), disposition, + node->url(), content::Referrer(), disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); // is_renderer_initiated } diff --git a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc index ea5ada3..9df236d 100644 --- a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc @@ -226,8 +226,8 @@ void ExtensionInstallDialog::OnStoreLinkClick(GtkWidget* sender) { GURL store_url( extension_urls::GetWebstoreItemDetailURLPrefix() + extension_->id()); BrowserList::GetLastActive()->OpenURL(OpenURLParams( - store_url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, - false)); + store_url, content::Referrer(), NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, false)); OnResponse(dialog_, GTK_RESPONSE_CLOSE); } diff --git a/chrome/browser/ui/gtk/global_history_menu.cc b/chrome/browser/ui/gtk/global_history_menu.cc index 22e4170..b9c0212 100644 --- a/chrome/browser/ui/gtk/global_history_menu.cc +++ b/chrome/browser/ui/gtk/global_history_menu.cc @@ -385,7 +385,7 @@ void GlobalHistoryMenu::OnRecentlyClosedItemActivated(GtkWidget* sender) { item->session_id, false); } else { DCHECK(item->url.is_valid()); - browser_->OpenURL(OpenURLParams(item->url, GURL(), disposition, + browser_->OpenURL(OpenURLParams(item->url, content::Referrer(), disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); } } diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 7bdb062..30a04f9 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -1055,7 +1055,8 @@ gboolean LocationBarViewGtk::OnIconReleased(GtkWidget* sender, return FALSE; tab->OpenURL(OpenURLParams( - url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); + url, content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, + false)); return TRUE; } diff --git a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc index 2f7b0bc..1c35354 100644 --- a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc @@ -229,7 +229,8 @@ void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) { GURL(chrome::kPageInfoHelpCenterURL)); Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); browser->OpenURL(OpenURLParams( - url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); + url, content::Referrer(), NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, false)); bubble_->Close(); } diff --git a/chrome/browser/ui/gtk/sad_tab_gtk.cc b/chrome/browser/ui/gtk/sad_tab_gtk.cc index e0acb6a..873207d 100644 --- a/chrome/browser/ui/gtk/sad_tab_gtk.cc +++ b/chrome/browser/ui/gtk/sad_tab_gtk.cc @@ -161,6 +161,7 @@ void SadTabGtk::OnLinkButtonClick(GtkWidget* sender) { chrome::kCrashReasonURL : chrome::kKillReasonURL)); tab_contents_->OpenURL(OpenURLParams( - help_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false)); + help_url, content::Referrer(), CURRENT_TAB, + content::PAGE_TRANSITION_LINK, false)); } } diff --git a/chrome/browser/ui/gtk/view_id_util_browsertest.cc b/chrome/browser/ui/gtk/view_id_util_browsertest.cc index 13a2bf46..5e03955 100644 --- a/chrome/browser/ui/gtk/view_id_util_browsertest.cc +++ b/chrome/browser/ui/gtk/view_id_util_browsertest.cc @@ -55,7 +55,8 @@ IN_PROC_BROWSER_TEST_F(ViewIDTest, Delegate) { CheckViewID(VIEW_ID_TAB_0, true); CheckViewID(VIEW_ID_TAB_1, false); - browser()->OpenURL(OpenURLParams(GURL(chrome::kAboutBlankURL), GURL(), + browser()->OpenURL(OpenURLParams(GURL(chrome::kAboutBlankURL), + content::Referrer(), NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_TYPED, false)); diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc index b3746e0..60eb95e 100644 --- a/chrome/browser/ui/login/login_prompt_browsertest.cc +++ b/chrome/browser/ui/login/login_prompt_browsertest.cc @@ -682,13 +682,13 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, SupplyRedundantAuths) { WindowedAuthNeededObserver auth_needed_waiter_2(controller_2); contents_1->tab_contents()->OpenURL(OpenURLParams( test_server()->GetURL("auth-basic/1"), - GURL(), + content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); contents_2->tab_contents()->OpenURL(OpenURLParams( test_server()->GetURL("auth-basic/2"), - GURL(), + content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); @@ -748,13 +748,13 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, CancelRedundantAuths) { WindowedAuthNeededObserver auth_needed_waiter_2(controller_2); contents_1->tab_contents()->OpenURL(OpenURLParams( test_server()->GetURL("auth-basic/1"), - GURL(), + content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); contents_2->tab_contents()->OpenURL(OpenURLParams( test_server()->GetURL("auth-basic/2"), - GURL(), + content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); @@ -815,13 +815,13 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, controller_incognito); contents->tab_contents()->OpenURL(OpenURLParams( test_server()->GetURL("auth-basic/1"), - GURL(), + content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); contents_incognito->tab_contents()->OpenURL(OpenURLParams( test_server()->GetURL("auth-basic/2"), - GURL(), + content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc index ddd62370..9d2c655 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc @@ -123,8 +123,8 @@ class TestingPageNavigator : public PageNavigator { const GURL& referrer, WindowOpenDisposition disposition, content::PageTransition transition) OVERRIDE { - return OpenURL(OpenURLParams(url, referrer, disposition, transition, - false)); + return OpenURL(OpenURLParams(url, content::Referrer(), disposition, + transition, false)); } virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc index 0e317f9..6ebad3c 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc @@ -37,8 +37,8 @@ class TestingPageNavigator : public PageNavigator { const GURL& referrer, WindowOpenDisposition disposition, content::PageTransition transition) OVERRIDE { - return OpenURL(OpenURLParams(url, referrer, disposition, transition, - false)); + return OpenURL(OpenURLParams(url, content::Referrer(), disposition, + transition, false)); } virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc index c5f7fe6..1e65bc6 100644 --- a/chrome/browser/ui/views/sad_tab_view.cc +++ b/chrome/browser/ui/views/sad_tab_view.cc @@ -69,7 +69,7 @@ void SadTabView::LinkClicked(views::Link* source, int event_flags) { chrome::kKillReasonURL)); tab_contents_->OpenURL(OpenURLParams( help_url, - GURL(), + content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false /* is renderer initiated */)); diff --git a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc index c608471..228d618 100644 --- a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc +++ b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc @@ -36,7 +36,7 @@ TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( Browser* browser = NULL; browser::NavigateParams nav_params(browser, params.url, params.transition); nav_params.profile = profile_; - nav_params.referrer = params.referrer; + nav_params.referrer = params.referrer.url; if (source && source->is_crashed() && params.disposition == CURRENT_TAB && params.transition == content::PAGE_TRANSITION_LINK) diff --git a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc index 1c8a92e..b6360243 100644 --- a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc +++ b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc @@ -72,7 +72,7 @@ TEST_F(HtmlDialogTabContentsDelegateTest, DoNothingMethodsTest) { TEST_F(HtmlDialogTabContentsDelegateTest, OpenURLFromTabTest) { test_tab_contents_delegate_->OpenURLFromTab( - NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), GURL(), + NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); // This should create a new foreground tab in the existing browser. EXPECT_EQ(1, browser()->tab_count()); @@ -95,7 +95,7 @@ TEST_F(HtmlDialogTabContentsDelegateTest, DetachTest) { EXPECT_EQ(NULL, test_tab_contents_delegate_->profile()); // Now, none of the following calls should do anything. test_tab_contents_delegate_->OpenURLFromTab( - NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), GURL(), + NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); test_tab_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, gfx::Rect(), false); diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 2da5aa0..d0b4255 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -280,7 +280,7 @@ class CONTENT_EXPORT RenderViewHostDelegate : public IPC::Channel::Listener { // The page wants to transfer the request to a new renderer. virtual void RequestTransferURL(const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, int64 source_frame_id, const GlobalRequestID& old_request_id) {} diff --git a/content/browser/tab_contents/page_navigator.cc b/content/browser/tab_contents/page_navigator.cc index 1898fb7..4e9e9c3 100644 --- a/content/browser/tab_contents/page_navigator.cc +++ b/content/browser/tab_contents/page_navigator.cc @@ -11,7 +11,7 @@ class GURL; OpenURLParams::OpenURLParams( const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition, bool is_renderer_initiated) diff --git a/content/browser/tab_contents/page_navigator.h b/content/browser/tab_contents/page_navigator.h index 98bafd3..4ec0a3b 100644 --- a/content/browser/tab_contents/page_navigator.h +++ b/content/browser/tab_contents/page_navigator.h @@ -15,6 +15,7 @@ #include "content/browser/renderer_host/global_request_id.h" #include "content/common/content_export.h" #include "content/public/common/page_transition_types.h" +#include "content/public/common/referrer.h" #include "googleurl/src/gurl.h" #include "webkit/glue/window_open_disposition.h" @@ -22,7 +23,7 @@ class TabContents; struct CONTENT_EXPORT OpenURLParams { OpenURLParams(const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition, bool is_renderer_initiated); @@ -30,7 +31,7 @@ struct CONTENT_EXPORT OpenURLParams { // The URL/referrer to be opened. GURL url; - GURL referrer; + content::Referrer referrer; // The disposition requested by the navigation source. WindowOpenDisposition disposition; diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 3dae106..489e38d 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -580,8 +580,8 @@ TabContents* TabContents::OpenURL(const GURL& url, content::PageTransition transition) { // For specifying a referrer, use the version of OpenURL taking OpenURLParams. DCHECK(referrer.is_empty()); - return OpenURL(OpenURLParams(url, referrer, disposition, transition, - false)); + return OpenURL(OpenURLParams(url, content::Referrer(), disposition, + transition, false)); } TabContents* TabContents::OpenURL(const OpenURLParams& params) { @@ -1757,12 +1757,12 @@ void TabContents::RequestOpenURL(const GURL& url, int64 source_frame_id) { // Delegate to RequestTransferURL because this is just the generic // case where |old_request_id| is empty. - RequestTransferURL(url, referrer.url, disposition, source_frame_id, + RequestTransferURL(url, referrer, disposition, source_frame_id, GlobalRequestID()); } void TabContents::RequestTransferURL(const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, int64 source_frame_id, const GlobalRequestID& old_request_id) { @@ -1777,7 +1777,7 @@ void TabContents::RequestTransferURL(const GURL& url, // want web sites to see a referrer of "chrome://blah" (and some // chrome: URLs might have search terms or other stuff we don't want to // send to the site), so we send no referrer. - OpenURLParams params(url, GURL(), disposition, + OpenURLParams params(url, content::Referrer(), disposition, render_manager_.web_ui()->link_transition_type(), false /* is_renderer_initiated */); params.transferred_global_request_id = old_request_id; diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 734ad6c..78a6952 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -515,7 +515,7 @@ class CONTENT_EXPORT TabContents : public PageNavigator, int64 source_frame_id) OVERRIDE; virtual void RequestTransferURL( const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, int64 source_frame_id, const GlobalRequestID& transferred_global_request_id) OVERRIDE; diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc index 43d331b..e8ca205 100644 --- a/content/browser/tab_contents/tab_contents_delegate.cc +++ b/content/browser/tab_contents/tab_contents_delegate.cc @@ -149,8 +149,9 @@ void TabContentsDelegate::ViewSourceForTab(TabContents* source, // it with proper implementation. GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + page_url.spec()); - OpenURLFromTab(source, OpenURLParams( - url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); + OpenURLFromTab(source, OpenURLParams(url, content::Referrer(), + NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, false)); } void TabContentsDelegate::ViewSourceForFrame(TabContents* source, @@ -159,8 +160,9 @@ void TabContentsDelegate::ViewSourceForFrame(TabContents* source, // Same as ViewSourceForTab, but for given subframe. GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + frame_url.spec()); - OpenURLFromTab(source, OpenURLParams( - url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); + OpenURLFromTab(source, OpenURLParams(url, content::Referrer(), + NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, false)); } bool TabContentsDelegate::PreHandleKeyboardEvent( diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc index b9ad17d..1ffbf5a 100644 --- a/content/browser/tab_contents/tab_contents_observer.cc +++ b/content/browser/tab_contents/tab_contents_observer.cc @@ -101,7 +101,7 @@ void TabContentsObserver::StopNavigation() { } void TabContentsObserver::DidOpenURL(const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition) { } @@ -109,7 +109,7 @@ void TabContentsObserver::DidOpenURL(const GURL& url, void TabContentsObserver::DidOpenRequestedURL( TabContents* new_contents, const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition, int64 source_frame_id) { diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h index 9b90758..b774b6a 100644 --- a/content/browser/tab_contents/tab_contents_observer.h +++ b/content/browser/tab_contents/tab_contents_observer.h @@ -16,6 +16,7 @@ class RenderViewHost; namespace content { struct FrameNavigateParams; +struct Referrer; } // An observer API implemented by classes which are interested in various page @@ -75,13 +76,13 @@ class CONTENT_EXPORT TabContentsObserver : public IPC::Channel::Listener, virtual void StopNavigation(); virtual void DidOpenURL(const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition); virtual void DidOpenRequestedURL(TabContents* new_contents, const GURL& url, - const GURL& referrer, + const content::Referrer& referrer, WindowOpenDisposition disposition, content::PageTransition transition, int64 source_frame_id); |