| 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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |