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 } // namespace internal |
| 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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 (pos = url_str.find("?", pos)) != std::string::npos; pos += 1) { | 1440 (pos = url_str.find("?", pos)) != std::string::npos; pos += 1) { |
1432 url_str.replace(pos, 1, "&"); | 1441 url_str.replace(pos, 1, "&"); |
1433 } | 1442 } |
1434 } | 1443 } |
1435 | 1444 |
1436 GURL corrected_url = GURL(url_str); | 1445 GURL corrected_url = GURL(url_str); |
1437 | 1446 |
1438 // We don't modify any URLs that contain the enablejsapi=1 parameter | 1447 // We don't modify any URLs that contain the enablejsapi=1 parameter |
1439 // since the page may be interacting with the YouTube Flash player in | 1448 // since the page may be interacting with the YouTube Flash player in |
1440 // Javascript and we don't want to break working content. | 1449 // Javascript and we don't want to break working content. |
1441 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) | 1450 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) { |
| 1451 RecordYouTubeRewriteUMA(internal::FAILURE_ENABLEJSAPI); |
1442 return GURL(); | 1452 return GURL(); |
| 1453 } |
1443 | 1454 |
1444 // Change the path to use the YouTube HTML5 API | 1455 // Change the path to use the YouTube HTML5 API |
1445 std::string path = corrected_url.path(); | 1456 std::string path = corrected_url.path(); |
1446 path.replace(path.find("/v/"), 3, "/embed/"); | 1457 path.replace(path.find("/v/"), 3, "/embed/"); |
1447 | 1458 |
1448 url::Replacements<char> r; | 1459 url::Replacements<char> r; |
1449 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1460 r.SetPath(path.c_str(), url::Component(0, path.length())); |
1450 | 1461 |
| 1462 RecordYouTubeRewriteUMA(invalid_url ? internal::SUCCESS_PARAMS_REWRITE |
| 1463 : internal::SUCCESS); |
1451 return corrected_url.ReplaceComponents(r); | 1464 return corrected_url.ReplaceComponents(r); |
1452 } | 1465 } |
OLD | NEW |