| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/history/core/browser/url_utils.h" | 5 #include "components/history/core/browser/url_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 GURL ToggleHTTPAndHTTPS(const GURL& url) { | 73 GURL ToggleHTTPAndHTTPS(const GURL& url) { |
| 74 std::string new_scheme; | 74 std::string new_scheme; |
| 75 if (url.SchemeIs("http")) | 75 if (url.SchemeIs("http")) |
| 76 new_scheme = "https"; | 76 new_scheme = "https"; |
| 77 else if (url.SchemeIs("https")) | 77 else if (url.SchemeIs("https")) |
| 78 new_scheme = "http"; | 78 new_scheme = "http"; |
| 79 else | 79 else |
| 80 return GURL::EmptyGURL(); | 80 return GURL::EmptyGURL(); |
| 81 url::Component comp; | 81 url::Component comp; |
| 82 comp.len = new_scheme.length(); | 82 comp.len = static_cast<int>(new_scheme.length()); |
| 83 GURL::Replacements replacement; | 83 GURL::Replacements replacement; |
| 84 replacement.SetScheme(new_scheme.c_str(), comp); | 84 replacement.SetScheme(new_scheme.c_str(), comp); |
| 85 return url.ReplaceComponents(replacement); | 85 return url.ReplaceComponents(replacement); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace history | 88 } // namespace history |
| OLD | NEW |