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

Side by Side Diff: chrome/browser/ui/extensions/application_launch.cc

Issue 898613004: Sanitize referrers before we create them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/application_launch.h" 5 #include "chrome/browser/ui/extensions/application_launch.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "apps/launcher.h" 9 #include "apps/launcher.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 params.tabstrip_add_types = add_type; 255 params.tabstrip_add_types = add_type;
256 params.disposition = disposition; 256 params.disposition = disposition;
257 257
258 if (disposition == CURRENT_TAB) { 258 if (disposition == CURRENT_TAB) {
259 WebContents* existing_tab = 259 WebContents* existing_tab =
260 browser->tab_strip_model()->GetActiveWebContents(); 260 browser->tab_strip_model()->GetActiveWebContents();
261 TabStripModel* model = browser->tab_strip_model(); 261 TabStripModel* model = browser->tab_strip_model();
262 int tab_index = model->GetIndexOfWebContents(existing_tab); 262 int tab_index = model->GetIndexOfWebContents(existing_tab);
263 263
264 existing_tab->OpenURL(content::OpenURLParams( 264 existing_tab->OpenURL(content::OpenURLParams(
265 url, 265 url, content::Referrer::SanitizeForRequest(
266 content::Referrer(existing_tab->GetURL(), 266 url, content::Referrer(existing_tab->GetURL(),
267 blink::WebReferrerPolicyDefault), 267 blink::WebReferrerPolicyDefault)),
268 disposition, ui::PAGE_TRANSITION_LINK, false)); 268 disposition, ui::PAGE_TRANSITION_LINK, false));
269 // Reset existing_tab as OpenURL() may have clobbered it. 269 // Reset existing_tab as OpenURL() may have clobbered it.
270 existing_tab = browser->tab_strip_model()->GetActiveWebContents(); 270 existing_tab = browser->tab_strip_model()->GetActiveWebContents();
271 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) { 271 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) {
272 model->SetTabPinned(tab_index, true); 272 model->SetTabPinned(tab_index, true);
273 // Pinning may have moved the tab. 273 // Pinning may have moved the tab.
274 tab_index = model->GetIndexOfWebContents(existing_tab); 274 tab_index = model->GetIndexOfWebContents(existing_tab);
275 } 275 }
276 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) 276 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE)
277 model->ActivateTabAt(tab_index, true); 277 model->ActivateTabAt(tab_index, true);
278 278
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); 406 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete();
407 407
408 return tab; 408 return tab;
409 } 409 }
410 410
411 bool CanLaunchViaEvent(const extensions::Extension* extension) { 411 bool CanLaunchViaEvent(const extensions::Extension* extension) {
412 const extensions::Feature* feature = 412 const extensions::Feature* feature =
413 extensions::FeatureProvider::GetAPIFeature("app.runtime"); 413 extensions::FeatureProvider::GetAPIFeature("app.runtime");
414 return feature->IsAvailableToExtension(extension).is_available(); 414 return feature->IsAvailableToExtension(extension).is_available();
415 } 415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698