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

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

Issue 2206343002: Add metrics for YouTube Flash embed rewrite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layers
Patch Set: Addressed comments Created 4 years, 4 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 { 186 namespace {
187 187
188 const char kFlashYouTubeRewriteUMA[] = "Plugin.Flash.YouTubeRewrite";
189
190 void RecordYouTubeRewriteUMA(int status) {
Alexei Svitkine (slow) 2016/08/05 16:34:56 Param can be a YouTubeRewriteStatus type.
kdsilva 2016/08/08 11:04:42 Done.
191 UMA_HISTOGRAM_ENUMERATION(kFlashYouTubeRewriteUMA, status, NUM_PLUGIN_ERROR);
192 }
193
188 // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937) 194 // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937)
189 #if defined(ENABLE_PLUGINS) 195 #if defined(ENABLE_PLUGINS)
190 const char* const kPredefinedAllowedCameraDeviceOrigins[] = { 196 const char* const kPredefinedAllowedCameraDeviceOrigins[] = {
191 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", 197 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F",
192 "4EB74897CB187C7633357C2FE832E0AD6A44883A" 198 "4EB74897CB187C7633357C2FE832E0AD6A44883A"
193 }; 199 };
194 200
195 const char* const kPredefinedAllowedCompositorOrigins[] = { 201 const char* const kPredefinedAllowedCompositorOrigins[] = {
196 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", 202 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F",
197 "4EB74897CB187C7633357C2FE832E0AD6A44883A" 203 "4EB74897CB187C7633357C2FE832E0AD6A44883A"
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 (pos = url_str.find("?", pos)) != std::string::npos; pos += 1) { 1432 (pos = url_str.find("?", pos)) != std::string::npos; pos += 1) {
1427 url_str.replace(pos, 1, "&"); 1433 url_str.replace(pos, 1, "&");
1428 } 1434 }
1429 } 1435 }
1430 1436
1431 GURL corrected_url = GURL(url_str); 1437 GURL corrected_url = GURL(url_str);
1432 1438
1433 // We don't modify any URLs that contain the enablejsapi=1 parameter 1439 // 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 1440 // since the page may be interacting with the YouTube Flash player in
1435 // Javascript and we don't want to break working content. 1441 // Javascript and we don't want to break working content.
1436 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) 1442 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) {
1443 RecordYouTubeRewriteUMA(FAILURE_ENABLEJSAPI);
1437 return GURL(); 1444 return GURL();
1445 }
1438 1446
1439 // Change the path to use the YouTube HTML5 API 1447 // Change the path to use the YouTube HTML5 API
1440 std::string path = corrected_url.path(); 1448 std::string path = corrected_url.path();
1441 path.replace(path.find("/v/"), 3, "/embed/"); 1449 path.replace(path.find("/v/"), 3, "/embed/");
1442 1450
1443 url::Replacements<char> r; 1451 url::Replacements<char> r;
1444 r.SetPath(path.c_str(), url::Component(0, path.length())); 1452 r.SetPath(path.c_str(), url::Component(0, path.length()));
1445 1453
1454 RecordYouTubeRewriteUMA(invalid_url ? SUCCESS_PARAMS_REWRITE : SUCCESS);
1446 return corrected_url.ReplaceComponents(r); 1455 return corrected_url.ReplaceComponents(r);
1447 } 1456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698