Chromium Code Reviews| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 using blink::WebURLError; | 176 using blink::WebURLError; |
| 177 using blink::WebURLRequest; | 177 using blink::WebURLRequest; |
| 178 using blink::WebURLResponse; | 178 using blink::WebURLResponse; |
| 179 using blink::WebVector; | 179 using blink::WebVector; |
| 180 using content::PluginInstanceThrottler; | 180 using content::PluginInstanceThrottler; |
| 181 using content::RenderFrame; | 181 using content::RenderFrame; |
| 182 using content::RenderThread; | 182 using content::RenderThread; |
| 183 using content::WebPluginInfo; | 183 using content::WebPluginInfo; |
| 184 using extensions::Extension; | 184 using extensions::Extension; |
| 185 | 185 |
| 186 namespace internal { | |
| 187 const char kFlashYouTubeRewriteUMA[] = "Plugin.Flash.YouTubeRewrite"; | |
| 188 } | |
|
Alexei Svitkine (slow)
2016/08/08 11:32:34
Nit: // namespace internal
kdsilva
2016/08/08 19:10:20
Done.
| |
| 189 | |
| 186 namespace { | 190 namespace { |
| 187 | 191 |
| 192 void RecordYouTubeRewriteUMA(internal::YouTubeRewriteStatus status) { | |
| 193 UMA_HISTOGRAM_ENUMERATION(internal::kFlashYouTubeRewriteUMA, status, | |
| 194 internal::NUM_PLUGIN_ERROR); | |
| 195 } | |
| 196 | |
| 188 // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937) | 197 // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937) |
| 189 #if defined(ENABLE_PLUGINS) | 198 #if defined(ENABLE_PLUGINS) |
| 190 const char* const kPredefinedAllowedCameraDeviceOrigins[] = { | 199 const char* const kPredefinedAllowedCameraDeviceOrigins[] = { |
| 191 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", | 200 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", |
| 192 "4EB74897CB187C7633357C2FE832E0AD6A44883A" | 201 "4EB74897CB187C7633357C2FE832E0AD6A44883A" |
| 193 }; | 202 }; |
| 194 | 203 |
| 195 const char* const kPredefinedAllowedCompositorOrigins[] = { | 204 const char* const kPredefinedAllowedCompositorOrigins[] = { |
| 196 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", | 205 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", |
| 197 "4EB74897CB187C7633357C2FE832E0AD6A44883A" | 206 "4EB74897CB187C7633357C2FE832E0AD6A44883A" |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1426 (pos = url_str.find("?", pos)) != std::string::npos; pos += 1) { | 1435 (pos = url_str.find("?", pos)) != std::string::npos; pos += 1) { |
| 1427 url_str.replace(pos, 1, "&"); | 1436 url_str.replace(pos, 1, "&"); |
| 1428 } | 1437 } |
| 1429 } | 1438 } |
| 1430 | 1439 |
| 1431 GURL corrected_url = GURL(url_str); | 1440 GURL corrected_url = GURL(url_str); |
| 1432 | 1441 |
| 1433 // We don't modify any URLs that contain the enablejsapi=1 parameter | 1442 // We don't modify any URLs that contain the enablejsapi=1 parameter |
| 1434 // since the page may be interacting with the YouTube Flash player in | 1443 // since the page may be interacting with the YouTube Flash player in |
| 1435 // Javascript and we don't want to break working content. | 1444 // Javascript and we don't want to break working content. |
| 1436 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) | 1445 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) { |
| 1446 RecordYouTubeRewriteUMA(internal::FAILURE_ENABLEJSAPI); | |
| 1437 return GURL(); | 1447 return GURL(); |
| 1448 } | |
| 1438 | 1449 |
| 1439 // Change the path to use the YouTube HTML5 API | 1450 // Change the path to use the YouTube HTML5 API |
| 1440 std::string path = corrected_url.path(); | 1451 std::string path = corrected_url.path(); |
| 1441 path.replace(path.find("/v/"), 3, "/embed/"); | 1452 path.replace(path.find("/v/"), 3, "/embed/"); |
| 1442 | 1453 |
| 1443 url::Replacements<char> r; | 1454 url::Replacements<char> r; |
| 1444 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1455 r.SetPath(path.c_str(), url::Component(0, path.length())); |
| 1445 | 1456 |
| 1457 RecordYouTubeRewriteUMA(invalid_url ? internal::SUCCESS_PARAMS_REWRITE | |
| 1458 : internal::SUCCESS); | |
| 1446 return corrected_url.ReplaceComponents(r); | 1459 return corrected_url.ReplaceComponents(r); |
| 1447 } | 1460 } |
| OLD | NEW |