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

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

Issue 8784006: Replace the GURL referrer field of OpenURLParams with a content::Referrer (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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 !render_view_host()->SuddenTerminationAllowed(); 573 !render_view_host()->SuddenTerminationAllowed();
574 } 574 }
575 575
576 // TODO(adriansc): Remove this method once refactoring changed all call sites. 576 // TODO(adriansc): Remove this method once refactoring changed all call sites.
577 TabContents* TabContents::OpenURL(const GURL& url, 577 TabContents* TabContents::OpenURL(const GURL& url,
578 const GURL& referrer, 578 const GURL& referrer,
579 WindowOpenDisposition disposition, 579 WindowOpenDisposition disposition,
580 content::PageTransition transition) { 580 content::PageTransition transition) {
581 // For specifying a referrer, use the version of OpenURL taking OpenURLParams. 581 // For specifying a referrer, use the version of OpenURL taking OpenURLParams.
582 DCHECK(referrer.is_empty()); 582 DCHECK(referrer.is_empty());
583 return OpenURL(OpenURLParams(url, referrer, disposition, transition, 583 return OpenURL(OpenURLParams(url, content::Referrer(), disposition,
584 false)); 584 transition, false));
585 } 585 }
586 586
587 TabContents* TabContents::OpenURL(const OpenURLParams& params) { 587 TabContents* TabContents::OpenURL(const OpenURLParams& params) {
588 if (delegate_) { 588 if (delegate_) {
589 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); 589 TabContents* new_contents = delegate_->OpenURLFromTab(this, params);
590 // Notify observers. 590 // Notify observers.
591 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 591 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
592 DidOpenURL(params.url, params.referrer, 592 DidOpenURL(params.url, params.referrer,
593 params.disposition, params.transition)); 593 params.disposition, params.transition));
594 return new_contents; 594 return new_contents;
(...skipping 1155 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, content::Referrer(), 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, 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);
(...skipping 287 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
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/tab_contents_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698