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

Side by Side Diff: net/base/host_port_pair.cc

Issue 3390026: net: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix include order Created 10 years, 3 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
« no previous file with comments | « net/base/host_cache_unittest.cc ('k') | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/base/host_port_pair.h" 5 #include "net/base/host_port_pair.h"
6
6 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h"
7 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
8 10
9 namespace net { 11 namespace net {
10 12
11 HostPortPair::HostPortPair() : port_(0) {} 13 HostPortPair::HostPortPair() : port_(0) {}
12 HostPortPair::HostPortPair(const std::string& in_host, uint16 in_port) 14 HostPortPair::HostPortPair(const std::string& in_host, uint16 in_port)
13 : host_(in_host), port_(in_port) {} 15 : host_(in_host), port_(in_port) {}
14 16
15 // static 17 // static
16 HostPortPair HostPortPair::FromURL(const GURL& url) { 18 HostPortPair HostPortPair::FromURL(const GURL& url) {
17 return HostPortPair(url.HostNoBrackets(), url.EffectiveIntPort()); 19 return HostPortPair(url.HostNoBrackets(), url.EffectiveIntPort());
18 } 20 }
19 21
20 std::string HostPortPair::ToString() const { 22 std::string HostPortPair::ToString() const {
21 return StringPrintf("%s:%u", HostForURL().c_str(), port_); 23 return base::StringPrintf("%s:%u", HostForURL().c_str(), port_);
22 } 24 }
23 25
24 std::string HostPortPair::HostForURL() const { 26 std::string HostPortPair::HostForURL() const {
25 // Check to see if the host is an IPv6 address. If so, added brackets. 27 // Check to see if the host is an IPv6 address. If so, added brackets.
26 if (host_.find(':') != std::string::npos) { 28 if (host_.find(':') != std::string::npos) {
27 DCHECK_NE(host_[0], '['); 29 DCHECK_NE(host_[0], '[');
28 return StringPrintf("[%s]", host_.c_str()); 30 return base::StringPrintf("[%s]", host_.c_str());
29 } 31 }
30 32
31 return host_; 33 return host_;
32 } 34 }
33 35
34 } // namespace net 36 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_cache_unittest.cc ('k') | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698