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

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

Issue 274040: More style nits. (Closed)
Patch Set: Created 11 years, 2 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
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 "chrome/browser/net/url_fixer_upper.h" 5 #include "chrome/browser/net/url_fixer_upper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // ":7:7", returns false. Otherwise, removes any extra colons 239 // ":7:7", returns false. Otherwise, removes any extra colons
240 // ("::1337" -> ":1337", ":/" -> "/") and returns true. 240 // ("::1337" -> ":1337", ":/" -> "/") and returns true.
241 static void FixupPort(const string& text, 241 static void FixupPort(const string& text,
242 const url_parse::Component& part, 242 const url_parse::Component& part,
243 string* url) { 243 string* url) {
244 if (!part.is_valid()) 244 if (!part.is_valid())
245 return; 245 return;
246 246
247 // Look for non-digit in port and strip if found. 247 // Look for non-digit in port and strip if found.
248 string port(text, part.begin, part.len); 248 string port(text, part.begin, part.len);
249 for (string::iterator i = port.begin(); i != port.end(); ) { 249 for (string::iterator i = port.begin(); i != port.end();) {
250 if (IsAsciiDigit(*i)) 250 if (IsAsciiDigit(*i))
251 ++i; 251 ++i;
252 else 252 else
253 i = port.erase(i); 253 i = port.erase(i);
254 } 254 }
255 255
256 if (port.empty()) 256 if (port.empty())
257 return; // Nothing to append. 257 return; // Nothing to append.
258 258
259 url->append(":"); 259 url->append(":");
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 563 }
564 wstring URLFixerUpper::FixupURL(const wstring& text, 564 wstring URLFixerUpper::FixupURL(const wstring& text,
565 const wstring& desired_tld) { 565 const wstring& desired_tld) {
566 return UTF8ToWide(FixupURL(WideToUTF8(text), WideToUTF8(desired_tld))); 566 return UTF8ToWide(FixupURL(WideToUTF8(text), WideToUTF8(desired_tld)));
567 } 567 }
568 wstring URLFixerUpper::FixupRelativeFile(const wstring& base_dir, 568 wstring URLFixerUpper::FixupRelativeFile(const wstring& base_dir,
569 const wstring& text) { 569 const wstring& text) {
570 return UTF8ToWide(FixupRelativeFile(FilePath::FromWStringHack(base_dir), 570 return UTF8ToWide(FixupRelativeFile(FilePath::FromWStringHack(base_dir),
571 FilePath::FromWStringHack(text))); 571 FilePath::FromWStringHack(text)));
572 } 572 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698