| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "chrome/browser/net/url_fixer_upper.h" | 7 #include "chrome/browser/net/url_fixer_upper.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 return true; | 259 return true; |
| 260 } | 260 } |
| 261 | 261 |
| 262 string URLFixerUpper::SegmentURL(const string& text, | 262 string URLFixerUpper::SegmentURL(const string& text, |
| 263 url_parse::Parsed* parts) { | 263 url_parse::Parsed* parts) { |
| 264 // Initialize the result. | 264 // Initialize the result. |
| 265 *parts = url_parse::Parsed(); | 265 *parts = url_parse::Parsed(); |
| 266 | 266 |
| 267 string trimmed; | 267 string trimmed; |
| 268 TrimWhitespace(text, TRIM_ALL, &trimmed); | 268 TrimWhitespaceUTF8(text, TRIM_ALL, &trimmed); |
| 269 if (trimmed.empty()) | 269 if (trimmed.empty()) |
| 270 return string(); // Nothing to segment. | 270 return string(); // Nothing to segment. |
| 271 | 271 |
| 272 #if defined(OS_WIN) | 272 #if defined(OS_WIN) |
| 273 int trimmed_length = static_cast<int>(trimmed.length()); | 273 int trimmed_length = static_cast<int>(trimmed.length()); |
| 274 if (url_parse::DoesBeginWindowsDriveSpec(trimmed.data(), 0, trimmed_length) || | 274 if (url_parse::DoesBeginWindowsDriveSpec(trimmed.data(), 0, trimmed_length) || |
| 275 url_parse::DoesBeginUNCPath(trimmed.data(), 0, trimmed_length, false)) | 275 url_parse::DoesBeginUNCPath(trimmed.data(), 0, trimmed_length, false)) |
| 276 return "file"; | 276 return "file"; |
| 277 #elif defined(OS_POSIX) | 277 #elif defined(OS_POSIX) |
| 278 if (FilePath::IsSeparator(trimmed.c_str()[0])) | 278 if (FilePath::IsSeparator(trimmed.c_str()[0])) |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 473 } |
| 474 wstring URLFixerUpper::FixupURL(const wstring& text, | 474 wstring URLFixerUpper::FixupURL(const wstring& text, |
| 475 const wstring& desired_tld) { | 475 const wstring& desired_tld) { |
| 476 return UTF8ToWide(FixupURL(WideToUTF8(text), WideToUTF8(desired_tld))); | 476 return UTF8ToWide(FixupURL(WideToUTF8(text), WideToUTF8(desired_tld))); |
| 477 } | 477 } |
| 478 wstring URLFixerUpper::FixupRelativeFile(const wstring& base_dir, | 478 wstring URLFixerUpper::FixupRelativeFile(const wstring& base_dir, |
| 479 const wstring& text) { | 479 const wstring& text) { |
| 480 return UTF8ToWide(FixupRelativeFile(FilePath::FromWStringHack(base_dir), | 480 return UTF8ToWide(FixupRelativeFile(FilePath::FromWStringHack(base_dir), |
| 481 FilePath::FromWStringHack(text))); | 481 FilePath::FromWStringHack(text))); |
| 482 } | 482 } |
| OLD | NEW |