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

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

Issue 2377833002: Block navigations in extensions via ShouldTransferNavigation (not via OpenURL). (Closed)
Patch Set: Add missing files under chrome/test/data/extensions/api_test/browser_action/popup_with_form/ 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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 // process if it is an Instant url, or to another process if not. Conversely, 1069 // process if it is an Instant url, or to another process if not. Conversely,
1070 // fork if this is a non-Instant process navigating to an Instant url, so that 1070 // fork if this is a non-Instant process navigating to an Instant url, so that
1071 // such navigations can also be bucketed into an Instant renderer. 1071 // such navigations can also be bucketed into an Instant renderer.
1072 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1072 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1073 switches::kInstantProcess) || 1073 switches::kInstantProcess) ||
1074 SearchBouncer::GetInstance()->ShouldFork(url)) { 1074 SearchBouncer::GetInstance()->ShouldFork(url)) {
1075 *send_referrer = true; 1075 *send_referrer = true;
1076 return true; 1076 return true;
1077 } 1077 }
1078 1078
1079 // TODO(lukasza): https://crbug.com/650694: For now, we skip the rest for POST
1080 // submissions. This is because 1) in M54 there are some remaining issues
1081 // with POST in OpenURL path (e.g. https://crbug.com/648648) and 2) OpenURL
1082 // path regresses (blocks) navigations that result in downloads
1083 // (https://crbug.com/646261). In the long-term we should avoid forking for
1084 // extensions (not hosted apps though) altogether and rely on transfers logic
1085 // instead.
1086 if (http_method != "GET")
1087 return false;
1088
1079 // If |url| matches one of the prerendered URLs, stop this navigation and try 1089 // If |url| matches one of the prerendered URLs, stop this navigation and try
1080 // to swap in the prerendered page on the browser process. If the prerendered 1090 // to swap in the prerendered page on the browser process. If the prerendered
1081 // page no longer exists by the time the OpenURL IPC is handled, a normal 1091 // page no longer exists by the time the OpenURL IPC is handled, a normal
1082 // navigation is attempted. 1092 // navigation is attempted.
1083 if (prerender_dispatcher_.get() && 1093 if (prerender_dispatcher_.get() &&
1084 prerender_dispatcher_->IsPrerenderURL(url)) { 1094 prerender_dispatcher_->IsPrerenderURL(url)) {
1085 *send_referrer = true; 1095 *send_referrer = true;
1086 return true; 1096 return true;
1087 } 1097 }
1088 1098
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 1469
1460 url::Replacements<char> r; 1470 url::Replacements<char> r;
1461 r.SetPath(path.c_str(), url::Component(0, path.length())); 1471 r.SetPath(path.c_str(), url::Component(0, path.length()));
1462 1472
1463 if (result == internal::NUM_PLUGIN_ERROR) 1473 if (result == internal::NUM_PLUGIN_ERROR)
1464 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; 1474 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS;
1465 1475
1466 RecordYouTubeRewriteUMA(result); 1476 RecordYouTubeRewriteUMA(result);
1467 return corrected_url.ReplaceComponents(r); 1477 return corrected_url.ReplaceComponents(r);
1468 } 1478 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698