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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 2380193003: Block navigations in extensions via ShouldTransferNavigation (not via OpenURL). (Closed)
Patch Set: Created 4 years, 2 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/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 // process if it is an Instant url, or to another process if not. Conversely, 1083 // process if it is an Instant url, or to another process if not. Conversely,
1084 // fork if this is a non-Instant process navigating to an Instant url, so that 1084 // fork if this is a non-Instant process navigating to an Instant url, so that
1085 // such navigations can also be bucketed into an Instant renderer. 1085 // such navigations can also be bucketed into an Instant renderer.
1086 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1086 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1087 switches::kInstantProcess) || 1087 switches::kInstantProcess) ||
1088 SearchBouncer::GetInstance()->ShouldFork(url)) { 1088 SearchBouncer::GetInstance()->ShouldFork(url)) {
1089 *send_referrer = true; 1089 *send_referrer = true;
1090 return true; 1090 return true;
1091 } 1091 }
1092 1092
1093 // TODO(lukasza): https://crbug.com/650694: For now, we skip the rest for POST
1094 // submissions. This is because 1) in M54 there are some remaining issues
1095 // with POST in OpenURL path (e.g. https://crbug.com/648648) and 2) OpenURL
1096 // path regresses (blocks) navigations that result in downloads
1097 // (https://crbug.com/646261). In the long-term we should avoid forking for
1098 // extensions (not hosted apps though) altogether and rely on transfers logic
1099 // instead.
1100 if (http_method != "GET")
1101 return false;
1102
1093 // If |url| matches one of the prerendered URLs, stop this navigation and try 1103 // If |url| matches one of the prerendered URLs, stop this navigation and try
1094 // to swap in the prerendered page on the browser process. If the prerendered 1104 // to swap in the prerendered page on the browser process. If the prerendered
1095 // page no longer exists by the time the OpenURL IPC is handled, a normal 1105 // page no longer exists by the time the OpenURL IPC is handled, a normal
1096 // navigation is attempted. 1106 // navigation is attempted.
1097 if (prerender_dispatcher_.get() && 1107 if (prerender_dispatcher_.get() &&
1098 prerender_dispatcher_->IsPrerenderURL(url)) { 1108 prerender_dispatcher_->IsPrerenderURL(url)) {
1099 *send_referrer = true; 1109 *send_referrer = true;
1100 return true; 1110 return true;
1101 } 1111 }
1102 1112
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 1475
1466 url::Replacements<char> r; 1476 url::Replacements<char> r;
1467 r.SetPath(path.c_str(), url::Component(0, path.length())); 1477 r.SetPath(path.c_str(), url::Component(0, path.length()));
1468 1478
1469 if (result == internal::NUM_PLUGIN_ERROR) 1479 if (result == internal::NUM_PLUGIN_ERROR)
1470 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; 1480 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS;
1471 1481
1472 RecordYouTubeRewriteUMA(result); 1482 RecordYouTubeRewriteUMA(result);
1473 return corrected_url.ReplaceComponents(r); 1483 return corrected_url.ReplaceComponents(r);
1474 } 1484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698