| OLD | NEW |
| 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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 // process if it is an Instant url, or to another process if not. Conversely, | 1089 // process if it is an Instant url, or to another process if not. Conversely, |
| 1090 // fork if this is a non-Instant process navigating to an Instant url, so that | 1090 // fork if this is a non-Instant process navigating to an Instant url, so that |
| 1091 // such navigations can also be bucketed into an Instant renderer. | 1091 // such navigations can also be bucketed into an Instant renderer. |
| 1092 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1092 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1093 switches::kInstantProcess) || | 1093 switches::kInstantProcess) || |
| 1094 SearchBouncer::GetInstance()->ShouldFork(url)) { | 1094 SearchBouncer::GetInstance()->ShouldFork(url)) { |
| 1095 *send_referrer = true; | 1095 *send_referrer = true; |
| 1096 return true; | 1096 return true; |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 // TODO(lukasza): https://crbug.com/650694: For now, we skip the rest for POST |
| 1100 // submissions. This is because 1) in M54 there are some remaining issues |
| 1101 // with POST in OpenURL path (e.g. https://crbug.com/648648) and 2) OpenURL |
| 1102 // path regresses (blocks) navigations that result in downloads |
| 1103 // (https://crbug.com/646261). In the long-term we should avoid forking for |
| 1104 // extensions (not hosted apps though) altogether and rely on transfers logic |
| 1105 // instead. |
| 1106 if (http_method != "GET") |
| 1107 return false; |
| 1108 |
| 1099 // If |url| matches one of the prerendered URLs, stop this navigation and try | 1109 // If |url| matches one of the prerendered URLs, stop this navigation and try |
| 1100 // to swap in the prerendered page on the browser process. If the prerendered | 1110 // to swap in the prerendered page on the browser process. If the prerendered |
| 1101 // page no longer exists by the time the OpenURL IPC is handled, a normal | 1111 // page no longer exists by the time the OpenURL IPC is handled, a normal |
| 1102 // navigation is attempted. | 1112 // navigation is attempted. |
| 1103 if (prerender_dispatcher_.get() && | 1113 if (prerender_dispatcher_.get() && |
| 1104 prerender_dispatcher_->IsPrerenderURL(url)) { | 1114 prerender_dispatcher_->IsPrerenderURL(url)) { |
| 1105 *send_referrer = true; | 1115 *send_referrer = true; |
| 1106 return true; | 1116 return true; |
| 1107 } | 1117 } |
| 1108 | 1118 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 | 1489 |
| 1480 url::Replacements<char> r; | 1490 url::Replacements<char> r; |
| 1481 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1491 r.SetPath(path.c_str(), url::Component(0, path.length())); |
| 1482 | 1492 |
| 1483 if (result == internal::NUM_PLUGIN_ERROR) | 1493 if (result == internal::NUM_PLUGIN_ERROR) |
| 1484 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; | 1494 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; |
| 1485 | 1495 |
| 1486 RecordYouTubeRewriteUMA(result); | 1496 RecordYouTubeRewriteUMA(result); |
| 1487 return corrected_url.ReplaceComponents(r); | 1497 return corrected_url.ReplaceComponents(r); |
| 1488 } | 1498 } |
| OLD | NEW |