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

Side by Side Diff: chrome/browser/ui/browser.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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 browser::NavigateParams params(browser, extension_url, 762 browser::NavigateParams params(browser, extension_url,
763 content::PAGE_TRANSITION_START_PAGE); 763 content::PAGE_TRANSITION_START_PAGE);
764 params.tabstrip_add_types = add_type; 764 params.tabstrip_add_types = add_type;
765 params.disposition = disposition; 765 params.disposition = disposition;
766 766
767 if (disposition == CURRENT_TAB) { 767 if (disposition == CURRENT_TAB) {
768 TabContents* existing_tab = browser->GetSelectedTabContents(); 768 TabContents* existing_tab = browser->GetSelectedTabContents();
769 TabStripModel* model = browser->tabstrip_model(); 769 TabStripModel* model = browser->tabstrip_model();
770 int tab_index = model->GetWrapperIndex(existing_tab); 770 int tab_index = model->GetWrapperIndex(existing_tab);
771 771
772 existing_tab->OpenURL(OpenURLParams(extension_url, existing_tab->GetURL(), 772 existing_tab->OpenURL(OpenURLParams(
773 disposition, content::PAGE_TRANSITION_LINK, false)); 773 extension_url,
774 content::Referrer(existing_tab->GetURL(),
775 WebKit::WebReferrerPolicyDefault),
776 disposition, content::PAGE_TRANSITION_LINK, false));
774 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) { 777 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) {
775 model->SetTabPinned(tab_index, true); 778 model->SetTabPinned(tab_index, true);
776 tab_index = model->GetWrapperIndex(existing_tab); 779 tab_index = model->GetWrapperIndex(existing_tab);
777 } 780 }
778 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) 781 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE)
779 model->ActivateTabAt(tab_index, true); 782 model->ActivateTabAt(tab_index, true);
780 783
781 contents = existing_tab; 784 contents = existing_tab;
782 } else { 785 } else {
783 browser::Navigate(&params); 786 browser::Navigate(&params);
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 /////////////////////////////////////////////////////////////////////////////// 2965 ///////////////////////////////////////////////////////////////////////////////
2963 // Browser, PageNavigator implementation: 2966 // Browser, PageNavigator implementation:
2964 2967
2965 // TODO(adriansc): Remove this method once refactoring changed all call sites. 2968 // TODO(adriansc): Remove this method once refactoring changed all call sites.
2966 TabContents* Browser::OpenURL(const GURL& url, 2969 TabContents* Browser::OpenURL(const GURL& url,
2967 const GURL& referrer, 2970 const GURL& referrer,
2968 WindowOpenDisposition disposition, 2971 WindowOpenDisposition disposition,
2969 content::PageTransition transition) { 2972 content::PageTransition transition) {
2970 // For specifying a referrer, use the version of OpenURL taking OpenURLParams. 2973 // For specifying a referrer, use the version of OpenURL taking OpenURLParams.
2971 DCHECK(referrer.is_empty()); 2974 DCHECK(referrer.is_empty());
2972 return OpenURLFromTab(NULL, OpenURLParams(url, referrer, disposition, 2975 return OpenURLFromTab(NULL, OpenURLParams(
2973 transition, false)); 2976 url, content::Referrer(), disposition, transition, false));
2974 } 2977 }
2975 2978
2976 TabContents* Browser::OpenURL(const OpenURLParams& params) { 2979 TabContents* Browser::OpenURL(const OpenURLParams& params) {
2977 return OpenURLFromTab(NULL, params); 2980 return OpenURLFromTab(NULL, params);
2978 } 2981 }
2979 2982
2980 /////////////////////////////////////////////////////////////////////////////// 2983 ///////////////////////////////////////////////////////////////////////////////
2981 // Browser, CommandUpdater::CommandUpdaterDelegate implementation: 2984 // Browser, CommandUpdater::CommandUpdaterDelegate implementation:
2982 2985
2983 void Browser::ExecuteCommand(int id) { 2986 void Browser::ExecuteCommand(int id) {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 3381
3379 /////////////////////////////////////////////////////////////////////////////// 3382 ///////////////////////////////////////////////////////////////////////////////
3380 // Browser, TabContentsDelegate implementation: 3383 // Browser, TabContentsDelegate implementation:
3381 3384
3382 TabContents* Browser::OpenURLFromTab(TabContents* source, 3385 TabContents* Browser::OpenURLFromTab(TabContents* source,
3383 const OpenURLParams& params) { 3386 const OpenURLParams& params) {
3384 browser::NavigateParams nav_params(this, params.url, params.transition); 3387 browser::NavigateParams nav_params(this, params.url, params.transition);
3385 nav_params.source_contents = 3388 nav_params.source_contents =
3386 tabstrip_model()->GetTabContentsAt( 3389 tabstrip_model()->GetTabContentsAt(
3387 tabstrip_model()->GetWrapperIndex(source)); 3390 tabstrip_model()->GetWrapperIndex(source));
3388 nav_params.referrer = params.referrer; 3391 nav_params.referrer = params.referrer.url;
3389 nav_params.disposition = params.disposition; 3392 nav_params.disposition = params.disposition;
3390 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; 3393 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE;
3391 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; 3394 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW;
3392 nav_params.user_gesture = true; 3395 nav_params.user_gesture = true;
3393 nav_params.override_encoding = params.override_encoding; 3396 nav_params.override_encoding = params.override_encoding;
3394 nav_params.is_renderer_initiated = params.is_renderer_initiated; 3397 nav_params.is_renderer_initiated = params.is_renderer_initiated;
3395 nav_params.transferred_global_request_id = 3398 nav_params.transferred_global_request_id =
3396 params.transferred_global_request_id; 3399 params.transferred_global_request_id;
3397 browser::Navigate(&nav_params); 3400 browser::Navigate(&nav_params);
3398 3401
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
5323 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); 5326 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type);
5324 } else { 5327 } else {
5325 GlobalErrorService* service = 5328 GlobalErrorService* service =
5326 GlobalErrorServiceFactory::GetForProfile(profile()); 5329 GlobalErrorServiceFactory::GetForProfile(profile());
5327 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); 5330 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView();
5328 if (error) { 5331 if (error) {
5329 error->ShowBubbleView(this); 5332 error->ShowBubbleView(this);
5330 } 5333 }
5331 } 5334 }
5332 } 5335 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.cc ('k') | chrome/browser/ui/cocoa/applescript/tab_applescript.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698