| 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/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 // If url->host() is "chrome" and url->path() has characters other than the | 456 // If url->host() is "chrome" and url->path() has characters other than the |
| 457 // first slash, changes the url from "foo://chrome/bar/" to "foo://bar/" and | 457 // first slash, changes the url from "foo://chrome/bar/" to "foo://bar/" and |
| 458 // returns true. Otherwise returns false. | 458 // returns true. Otherwise returns false. |
| 459 bool RemoveUberHost(GURL* url) { | 459 bool RemoveUberHost(GURL* url) { |
| 460 if (url->host() != chrome::kChromeUIUberHost) | 460 if (url->host() != chrome::kChromeUIUberHost) |
| 461 return false; | 461 return false; |
| 462 | 462 |
| 463 if (url->path().empty() || url->path() == "/") | 463 if (url->path().empty() || url->path() == "/") |
| 464 return false; | 464 return false; |
| 465 | 465 |
| 466 const std::string old_path = url->path(); | 466 const base::StringPiece old_path = url->path(); |
| 467 | 467 |
| 468 const std::string::size_type separator = old_path.find('/', 1); | 468 const std::string::size_type separator = old_path.find('/', 1); |
| 469 std::string new_host; | 469 std::string new_host; |
| 470 std::string new_path; | 470 std::string new_path; |
| 471 if (separator == std::string::npos) { | 471 if (separator == std::string::npos) { |
| 472 new_host = old_path.substr(1); | 472 new_host = old_path.substr(1).as_string(); |
| 473 } else { | 473 } else { |
| 474 new_host = old_path.substr(1, separator - 1); | 474 new_host = old_path.substr(1, separator - 1).as_string(); |
| 475 new_path = old_path.substr(separator); | 475 new_path = old_path.substr(separator).as_string(); |
| 476 } | 476 } |
| 477 | 477 |
| 478 // Do not allow URLs with paths empty before the first slash since we can't | 478 // Do not allow URLs with paths empty before the first slash since we can't |
| 479 // have an empty host. (e.g "foo://chrome//") | 479 // have an empty host. (e.g "foo://chrome//") |
| 480 if (new_host.empty()) | 480 if (new_host.empty()) |
| 481 return false; | 481 return false; |
| 482 | 482 |
| 483 *url = ReplaceURLHostAndPath(*url, new_host, new_path); | 483 *url = ReplaceURLHostAndPath(*url, new_host, new_path); |
| 484 | 484 |
| 485 DCHECK(url->is_valid()); | 485 DCHECK(url->is_valid()); |
| (...skipping 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3226 kWebRtcDevSwitchNames, | 3226 kWebRtcDevSwitchNames, |
| 3227 arraysize(kWebRtcDevSwitchNames)); | 3227 arraysize(kWebRtcDevSwitchNames)); |
| 3228 } | 3228 } |
| 3229 } | 3229 } |
| 3230 #endif // defined(ENABLE_WEBRTC) | 3230 #endif // defined(ENABLE_WEBRTC) |
| 3231 | 3231 |
| 3232 std::unique_ptr<content::MemoryCoordinatorDelegate> | 3232 std::unique_ptr<content::MemoryCoordinatorDelegate> |
| 3233 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { | 3233 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { |
| 3234 return memory::ChromeMemoryCoordinatorDelegate::Create(); | 3234 return memory::ChromeMemoryCoordinatorDelegate::Create(); |
| 3235 } | 3235 } |
| OLD | NEW |