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

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

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) { 1467 if (corrected_url.query().find("enablejsapi=1") != std::string::npos) {
1468 #if defined(OS_ANDROID) 1468 #if defined(OS_ANDROID)
1469 result = internal::SUCCESS_ENABLEJSAPI; 1469 result = internal::SUCCESS_ENABLEJSAPI;
1470 #else 1470 #else
1471 RecordYouTubeRewriteUMA(internal::FAILURE_ENABLEJSAPI); 1471 RecordYouTubeRewriteUMA(internal::FAILURE_ENABLEJSAPI);
1472 return GURL(); 1472 return GURL();
1473 #endif 1473 #endif
1474 } 1474 }
1475 1475
1476 // Change the path to use the YouTube HTML5 API 1476 // Change the path to use the YouTube HTML5 API
1477 std::string path = corrected_url.path(); 1477 std::string path = corrected_url.path().as_string();
1478 path.replace(path.find("/v/"), 3, "/embed/"); 1478 path.replace(path.find("/v/"), 3, "/embed/");
1479 1479
1480 url::Replacements<char> r; 1480 url::Replacements<char> r;
1481 r.SetPath(path.c_str(), url::Component(0, path.length())); 1481 r.SetPath(path.c_str(), url::Component(0, path.length()));
1482 1482
1483 if (result == internal::NUM_PLUGIN_ERROR) 1483 if (result == internal::NUM_PLUGIN_ERROR)
1484 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; 1484 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS;
1485 1485
1486 RecordYouTubeRewriteUMA(result); 1486 RecordYouTubeRewriteUMA(result);
1487 return corrected_url.ReplaceComponents(r); 1487 return corrected_url.ReplaceComponents(r);
1488 } 1488 }
OLDNEW
« no previous file with comments | « chrome/renderer/app_categorizer.cc ('k') | chrome/renderer/extensions/resource_request_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698