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

Side by Side Diff: chrome/browser/net/url_fixer_upper.cc

Issue 20219: Fixes Issue 7377: Regression: Omnibox trims URL ending with 0x85... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 | Annotate | Revision Log
OLDNEW
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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 OffsetComponent(offset, &parts->path); 353 OffsetComponent(offset, &parts->path);
354 OffsetComponent(offset, &parts->query); 354 OffsetComponent(offset, &parts->query);
355 OffsetComponent(offset, &parts->ref); 355 OffsetComponent(offset, &parts->ref);
356 356
357 return scheme; 357 return scheme;
358 } 358 }
359 359
360 string URLFixerUpper::FixupURL(const string& text, 360 string URLFixerUpper::FixupURL(const string& text,
361 const string& desired_tld) { 361 const string& desired_tld) {
362 string trimmed; 362 string trimmed;
363 TrimWhitespace(text, TRIM_ALL, &trimmed); 363 TrimWhitespaceUTF8(text, TRIM_ALL, &trimmed);
364 if (trimmed.empty()) 364 if (trimmed.empty())
365 return string(); // Nothing here. 365 return string(); // Nothing here.
366 366
367 // Segment the URL. 367 // Segment the URL.
368 url_parse::Parsed parts; 368 url_parse::Parsed parts;
369 string scheme(SegmentURL(trimmed, &parts)); 369 string scheme(SegmentURL(trimmed, &parts));
370 370
371 // We handle the file scheme separately. 371 // We handle the file scheme separately.
372 if (scheme == "file") 372 if (scheme == "file")
373 return (parts.scheme.is_valid() ? text : FixupPath(text)); 373 return (parts.scheme.is_valid() ? text : FixupPath(text));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « build/googleurl.xcodeproj/project.pbxproj ('k') | chrome/browser/net/url_fixer_upper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698