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

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

Issue 8801006: Make the transfer request code path use full referrers (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 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 content::Source<TabContents>(this), 1750 content::Source<TabContents>(this),
1751 content::Details<int>(&page_id)); 1751 content::Details<int>(&page_id));
1752 } 1752 }
1753 1753
1754 void TabContents::RequestOpenURL(const GURL& url, 1754 void TabContents::RequestOpenURL(const GURL& url,
1755 const content::Referrer& referrer, 1755 const content::Referrer& referrer,
1756 WindowOpenDisposition disposition, 1756 WindowOpenDisposition disposition,
1757 int64 source_frame_id) { 1757 int64 source_frame_id) {
1758 // Delegate to RequestTransferURL because this is just the generic 1758 // Delegate to RequestTransferURL because this is just the generic
1759 // case where |old_request_id| is empty. 1759 // case where |old_request_id| is empty.
1760 RequestTransferURL(url, referrer.url, disposition, source_frame_id, 1760 RequestTransferURL(url, referrer, disposition, source_frame_id,
1761 GlobalRequestID()); 1761 GlobalRequestID());
1762 } 1762 }
1763 1763
1764 void TabContents::RequestTransferURL(const GURL& url, 1764 void TabContents::RequestTransferURL(const GURL& url,
1765 const GURL& referrer, 1765 const content::Referrer& referrer,
1766 WindowOpenDisposition disposition, 1766 WindowOpenDisposition disposition,
1767 int64 source_frame_id, 1767 int64 source_frame_id,
1768 const GlobalRequestID& old_request_id) { 1768 const GlobalRequestID& old_request_id) {
1769 TabContents* new_contents = NULL; 1769 TabContents* new_contents = NULL;
1770 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; 1770 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK;
1771 if (render_manager_.web_ui()) { 1771 if (render_manager_.web_ui()) {
1772 // When we're a Web UI, it will provide a page transition type for us (this 1772 // When we're a Web UI, it will provide a page transition type for us (this
1773 // is so the new tab page can specify AUTO_BOOKMARK for automatically 1773 // is so the new tab page can specify AUTO_BOOKMARK for automatically
1774 // generated suggestions). 1774 // generated suggestions).
1775 // 1775 //
1776 // Note also that we hide the referrer for Web UI pages. We don't really 1776 // Note also that we hide the referrer for Web UI pages. We don't really
1777 // want web sites to see a referrer of "chrome://blah" (and some 1777 // want web sites to see a referrer of "chrome://blah" (and some
1778 // chrome: URLs might have search terms or other stuff we don't want to 1778 // chrome: URLs might have search terms or other stuff we don't want to
1779 // send to the site), so we send no referrer. 1779 // send to the site), so we send no referrer.
1780 OpenURLParams params(url, GURL(), disposition, 1780 OpenURLParams params(url, GURL(), disposition,
1781 render_manager_.web_ui()->link_transition_type(), 1781 render_manager_.web_ui()->link_transition_type(),
1782 false /* is_renderer_initiated */); 1782 false /* is_renderer_initiated */);
1783 params.transferred_global_request_id = old_request_id; 1783 params.transferred_global_request_id = old_request_id;
1784 new_contents = OpenURL(params); 1784 new_contents = OpenURL(params);
1785 transition_type = render_manager_.web_ui()->link_transition_type(); 1785 transition_type = render_manager_.web_ui()->link_transition_type();
1786 } else { 1786 } else {
1787 OpenURLParams params(url, referrer, disposition, 1787 OpenURLParams params(url, referrer.url, disposition,
1788 content::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); 1788 content::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */);
1789 params.transferred_global_request_id = old_request_id; 1789 params.transferred_global_request_id = old_request_id;
1790 new_contents = OpenURL(params); 1790 new_contents = OpenURL(params);
1791 } 1791 }
1792 if (new_contents) { 1792 if (new_contents) {
1793 // Notify observers. 1793 // Notify observers.
1794 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1794 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1795 DidOpenRequestedURL(new_contents, 1795 DidOpenRequestedURL(new_contents,
1796 url, 1796 url,
1797 referrer, 1797 referrer.url,
1798 disposition, 1798 disposition,
1799 transition_type, 1799 transition_type,
1800 source_frame_id)); 1800 source_frame_id));
1801 } 1801 }
1802 } 1802 }
1803 1803
1804 void TabContents::RunJavaScriptMessage( 1804 void TabContents::RunJavaScriptMessage(
1805 const RenderViewHost* rvh, 1805 const RenderViewHost* rvh,
1806 const string16& message, 1806 const string16& message,
1807 const string16& default_prompt, 1807 const string16& default_prompt,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2078 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2079 // Can be NULL during tests. 2079 // Can be NULL during tests.
2080 if (rwh_view) 2080 if (rwh_view)
2081 rwh_view->SetSize(view()->GetContainerSize()); 2081 rwh_view->SetSize(view()->GetContainerSize());
2082 } 2082 }
2083 2083
2084 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { 2084 bool TabContents::GotResponseToLockMouseRequest(bool allowed) {
2085 return render_view_host() ? 2085 return render_view_host() ?
2086 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; 2086 render_view_host()->GotResponseToLockMouseRequest(allowed) : false;
2087 } 2087 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698