diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-27 23:01:50 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-27 23:01:50 +0000 |
commit | c058805b99cce98cbc352c499f3e69fd355a84c2 (patch) | |
tree | 93fb4ffdf5daf4d8ae0e3291919a074a8b9e58a7 /chrome/browser/views | |
parent | f07cc2ebf950cb22c5c386f95a1be0292de4db3b (diff) | |
download | chromium_src-c058805b99cce98cbc352c499f3e69fd355a84c2.zip chromium_src-c058805b99cce98cbc352c499f3e69fd355a84c2.tar.gz chromium_src-c058805b99cce98cbc352c499f3e69fd355a84c2.tar.bz2 |
Plumb the referrer throughout the OpenURL APIs.
http://code.google.com/p/chromium/issues/detail?id=3224
Caveats:
* Did not update TabNavigation yet. Hence session restore will continue to load the tabs with empty referrer.
* Did not plumb referrer into incognito url open. (Not sure what the right thing to do is here with respect to privacy vs compatibility.)
* Did not plumb referrer throughout the automation controller. No functional impact here, but it makes the code inconsistent with the non-automation version.
Review URL: http://codereview.chromium.org/8186
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/about_chrome_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view_test.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/bug_report_view.cc | 1 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/dom_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/html_dialog_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/html_dialog_view.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/info_bar_alternate_nav_url_view.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/options/advanced_contents_view.cc | 1 | ||||
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_controller.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_controller.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 5 |
14 files changed, 23 insertions, 11 deletions
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index e0ec434..ea962ff 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -595,7 +595,7 @@ void AboutChromeView::LinkActivated(views::Link* source, NOTREACHED() << "Unknown link source"; Browser* browser = BrowserList::GetLastActive(); - browser->OpenURL(url, NEW_WINDOW, PageTransition::LINK); + browser->OpenURL(url, GURL(), NEW_WINDOW, PageTransition::LINK); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 28d6b98..70be891 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -453,7 +453,7 @@ class MenuRunner : public views::MenuDelegate, DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); url = menu_id_to_node_map_[id]->GetURL(); view_->GetPageNavigator()->OpenURL( - url, event_utils::DispositionFromEventFlags(mouse_event_flags), + url, GURL(), event_utils::DispositionFromEventFlags(mouse_event_flags), PageTransition::AUTO_BOOKMARK); } @@ -1418,7 +1418,7 @@ void BookmarkBarView::ButtonPressed(views::BaseButton* sender) { DCHECK(page_navigator_); if (node->is_url()) { page_navigator_->OpenURL( - node->GetURL(), + node->GetURL(), GURL(), event_utils::DispositionFromEventFlags(sender->mouse_event_flags()), PageTransition::AUTO_BOOKMARK); } else { diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc index c242a7b..c97bf3b 100644 --- a/chrome/browser/views/bookmark_bar_view_test.cc +++ b/chrome/browser/views/bookmark_bar_view_test.cc @@ -21,7 +21,7 @@ namespace { // PageNavigator implementation that records the URL. class TestingPageNavigator : public PageNavigator { public: - virtual void OpenURL(const GURL& url, + virtual void OpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { url_ = url; diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc index d53924b..58d70aa 100644 --- a/chrome/browser/views/bug_report_view.cc +++ b/chrome/browser/views/bug_report_view.cc @@ -485,6 +485,7 @@ void BugReportView::ReportPhishing() { tab_->controller()->LoadURL( safe_browsing_util::GeneratePhishingReportUrl( kReportPhishingUrl, WideToUTF8(page_url_text_->GetText())), + GURL(), PageTransition::LINK); } diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index bdd6d0f..c687041 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -980,10 +980,11 @@ void ConstrainedWindowImpl::ActivateContents(TabContents* contents) { void ConstrainedWindowImpl::OpenURLFromTab(TabContents* source, const GURL& url, + const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { // We ignore source right now. - owner_->OpenURL(this, url, disposition, transition); + owner_->OpenURL(this, url, referrer, disposition, transition); } void ConstrainedWindowImpl::LoadingStateChanged(TabContents* source) { diff --git a/chrome/browser/views/constrained_window_impl.h b/chrome/browser/views/constrained_window_impl.h index d28e9d3..479b173 100644 --- a/chrome/browser/views/constrained_window_impl.h +++ b/chrome/browser/views/constrained_window_impl.h @@ -54,6 +54,7 @@ class ConstrainedWindowImpl : public ConstrainedWindow, // Overridden from PageNavigator (TabContentsDelegate's base interface): virtual void OpenURLFromTab(TabContents* source, const GURL& url, + const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition); diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc index 5ea720e..ebb63e3 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -35,7 +35,7 @@ bool DOMView::Init(Profile* profile, SiteInstance* instance) { views::HWNDView::Attach(host_->GetContainerHWND()); host_->SetupController(profile); - host_->controller()->LoadURL(contents_, PageTransition::START_PAGE); + host_->controller()->LoadURL(contents_, GURL(), PageTransition::START_PAGE); return true; } diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/views/html_dialog_view.cc index 9bf42b7..ea8fd14 100644 --- a/chrome/browser/views/html_dialog_view.cc +++ b/chrome/browser/views/html_dialog_view.cc @@ -86,12 +86,14 @@ void HtmlDialogView::OnDialogClosed(const std::string& json_retval) { // PageNavigator implementation: void HtmlDialogView::OpenURLFromTab(TabContents* source, const GURL& url, + const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { // Force all links to open in a new window, ignoring the incoming // disposition. This is a tabless, modal dialog so we can't just // open it in the current frame. - parent_browser_->OpenURLFromTab(source, url, NEW_WINDOW, transition); + parent_browser_->OpenURLFromTab(source, url, referrer, NEW_WINDOW, + transition); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/html_dialog_view.h b/chrome/browser/views/html_dialog_view.h index e09c968..68e09adf 100644 --- a/chrome/browser/views/html_dialog_view.h +++ b/chrome/browser/views/html_dialog_view.h @@ -56,6 +56,7 @@ class HtmlDialogView // Overridden from TabContentsDelegate: virtual void OpenURLFromTab(TabContents* source, const GURL& url, + const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition); virtual void NavigationStateChanged(const TabContents* source, diff --git a/chrome/browser/views/info_bar_alternate_nav_url_view.cc b/chrome/browser/views/info_bar_alternate_nav_url_view.cc index bb0d13f..2eaa9e02 100644 --- a/chrome/browser/views/info_bar_alternate_nav_url_view.cc +++ b/chrome/browser/views/info_bar_alternate_nav_url_view.cc @@ -60,7 +60,8 @@ void InfoBarAlternateNavURLView::LinkActivated(views::Link* source, BeginClose(); - navigator->OpenURL(gurl, event_utils::DispositionFromEventFlags(event_flags), + navigator->OpenURL(gurl, GURL(), + event_utils::DispositionFromEventFlags(event_flags), // Pretend the user typed this URL, so that navigating to // it will be the default action when it's typed again in // the future. diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 6afc034..050d73d 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -457,6 +457,7 @@ void PrivacySection::LinkActivated(views::Link* source, int event_flags) { std::wstring()); browser->OpenURL( GURL(l10n_util::GetString(IDS_LEARN_MORE_HELPMAKECHROMEBETTER_URL)), + GURL(), NEW_WINDOW, PageTransition::LINK); } diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index c5bf55a..cf768a7 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -143,13 +143,15 @@ bool DraggedTabController::IsDragSourceTab(Tab* tab) const { void DraggedTabController::OpenURLFromTab(TabContents* source, const GURL& url, + const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { if (original_delegate_) { if (disposition == CURRENT_TAB) disposition = NEW_WINDOW; - original_delegate_->OpenURLFromTab(source, url, disposition, transition); + original_delegate_->OpenURLFromTab(source, url, referrer, + disposition, transition); } } diff --git a/chrome/browser/views/tabs/dragged_tab_controller.h b/chrome/browser/views/tabs/dragged_tab_controller.h index 041d2337..fb367c3 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.h +++ b/chrome/browser/views/tabs/dragged_tab_controller.h @@ -80,6 +80,7 @@ class DraggedTabController : public TabContentsDelegate, // Overridden from TabContentsDelegate: virtual void OpenURLFromTab(TabContents* source, const GURL& url, + const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition); virtual void NavigationStateChanged(const TabContents* source, diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index a1e1e41..55c4a908 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -709,14 +709,15 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) { // Insert a new tab. TabContents* contents = model_->delegate()->CreateTabContentsForURL( - url, model_->profile(), PageTransition::TYPED, false, NULL); + url, GURL(), model_->profile(), PageTransition::TYPED, false, + NULL); model_->AddTabContents(contents, drop_index, PageTransition::GENERATED, true); } else { UserMetrics::RecordAction(L"Tab_DropURLOnTab", model_->profile()); model_->GetTabContentsAt(drop_index)->controller()-> - LoadURL(url, PageTransition::GENERATED); + LoadURL(url, GURL(), PageTransition::GENERATED); model_->SelectTabContentsAt(drop_index, true); } |