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

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 8774050: Pass along the referrer policy (renderer side) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void MakeNavigateParams(const NavigationEntry& entry, 153 void MakeNavigateParams(const NavigationEntry& entry,
154 const NavigationController& controller, 154 const NavigationController& controller,
155 TabContentsDelegate* delegate, 155 TabContentsDelegate* delegate,
156 NavigationController::ReloadType reload_type, 156 NavigationController::ReloadType reload_type,
157 ViewMsg_Navigate_Params* params) { 157 ViewMsg_Navigate_Params* params) {
158 params->page_id = entry.page_id(); 158 params->page_id = entry.page_id();
159 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); 159 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry);
160 params->current_history_list_offset = controller.last_committed_entry_index(); 160 params->current_history_list_offset = controller.last_committed_entry_index();
161 params->current_history_list_length = controller.entry_count(); 161 params->current_history_list_length = controller.entry_count();
162 params->url = entry.url(); 162 params->url = entry.url();
163 params->referrer = entry.referrer(); 163 params->referrer = content::Referrer(entry.referrer(),
164 WebKit::WebReferrerPolicyDefault);
164 params->transition = entry.transition_type(); 165 params->transition = entry.transition_type();
165 params->state = entry.content_state(); 166 params->state = entry.content_state();
166 params->navigation_type = 167 params->navigation_type =
167 GetNavigationType(controller.browser_context(), entry, reload_type); 168 GetNavigationType(controller.browser_context(), entry, reload_type);
168 params->request_time = base::Time::Now(); 169 params->request_time = base::Time::Now();
169 params->extra_headers = entry.extra_headers(); 170 params->extra_headers = entry.extra_headers();
170 171
171 if (delegate) 172 if (delegate)
172 delegate->AddNavigationHeaders(params->url, &params->extra_headers); 173 delegate->AddNavigationHeaders(params->url, &params->extra_headers);
173 } 174 }
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 void TabContents::DocumentOnLoadCompletedInMainFrame( 1741 void TabContents::DocumentOnLoadCompletedInMainFrame(
1741 RenderViewHost* render_view_host, 1742 RenderViewHost* render_view_host,
1742 int32 page_id) { 1743 int32 page_id) {
1743 content::NotificationService::current()->Notify( 1744 content::NotificationService::current()->Notify(
1744 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 1745 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
1745 content::Source<TabContents>(this), 1746 content::Source<TabContents>(this),
1746 content::Details<int>(&page_id)); 1747 content::Details<int>(&page_id));
1747 } 1748 }
1748 1749
1749 void TabContents::RequestOpenURL(const GURL& url, 1750 void TabContents::RequestOpenURL(const GURL& url,
1750 const GURL& referrer, 1751 const content::Referrer& referrer,
1751 WindowOpenDisposition disposition, 1752 WindowOpenDisposition disposition,
1752 int64 source_frame_id) { 1753 int64 source_frame_id) {
1753 TabContents* new_contents = NULL; 1754 TabContents* new_contents = NULL;
1754 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; 1755 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK;
1755 if (render_manager_.web_ui()) { 1756 if (render_manager_.web_ui()) {
1756 // When we're a Web UI, it will provide a page transition type for us (this 1757 // When we're a Web UI, it will provide a page transition type for us (this
1757 // is so the new tab page can specify AUTO_BOOKMARK for automatically 1758 // is so the new tab page can specify AUTO_BOOKMARK for automatically
1758 // generated suggestions). 1759 // generated suggestions).
1759 // 1760 //
1760 // Note also that we hide the referrer for Web UI pages. We don't really 1761 // Note also that we hide the referrer for Web UI pages. We don't really
1761 // want web sites to see a referrer of "chrome://blah" (and some 1762 // want web sites to see a referrer of "chrome://blah" (and some
1762 // chrome: URLs might have search terms or other stuff we don't want to 1763 // chrome: URLs might have search terms or other stuff we don't want to
1763 // send to the site), so we send no referrer. 1764 // send to the site), so we send no referrer.
1764 new_contents = OpenURL(url, GURL(), disposition, 1765 new_contents = OpenURL(url, GURL(), disposition,
1765 render_manager_.web_ui()->link_transition_type()); 1766 render_manager_.web_ui()->link_transition_type());
1766 transition_type = render_manager_.web_ui()->link_transition_type(); 1767 transition_type = render_manager_.web_ui()->link_transition_type();
1767 } else { 1768 } else {
1768 new_contents = OpenURL(OpenURLParams( 1769 new_contents = OpenURL(OpenURLParams(
1769 url, referrer, disposition, content::PAGE_TRANSITION_LINK, 1770 url, referrer.url, disposition, content::PAGE_TRANSITION_LINK,
1770 true /* is_renderer_initiated */)); 1771 true /* is_renderer_initiated */));
1771 } 1772 }
1772 if (new_contents) { 1773 if (new_contents) {
1773 // Notify observers. 1774 // Notify observers.
1774 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1775 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1775 DidOpenRequestedURL(new_contents, 1776 DidOpenRequestedURL(new_contents,
1776 url, 1777 url,
1777 referrer, 1778 referrer.url,
1778 disposition, 1779 disposition,
1779 transition_type, 1780 transition_type,
1780 source_frame_id)); 1781 source_frame_id));
1781 } 1782 }
1782 } 1783 }
1783 1784
1784 void TabContents::RunJavaScriptMessage( 1785 void TabContents::RunJavaScriptMessage(
1785 const RenderViewHost* rvh, 1786 const RenderViewHost* rvh,
1786 const string16& message, 1787 const string16& message,
1787 const string16& default_prompt, 1788 const string16& default_prompt,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2059 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2059 // Can be NULL during tests. 2060 // Can be NULL during tests.
2060 if (rwh_view) 2061 if (rwh_view)
2061 rwh_view->SetSize(view()->GetContainerSize()); 2062 rwh_view->SetSize(view()->GetContainerSize());
2062 } 2063 }
2063 2064
2064 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { 2065 bool TabContents::GotResponseToLockMouseRequest(bool allowed) {
2065 return render_view_host() ? 2066 return render_view_host() ?
2066 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; 2067 render_view_host()->GotResponseToLockMouseRequest(allowed) : false;
2067 } 2068 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698