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

Side by Side Diff: net/quic/quic_server_id.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quic/quic_server_id.h" 5 #include "net/quic/quic_server_id.h"
6 6
7 using std::string; 7 using std::string;
8 8
9 namespace net { 9 namespace net {
10 10
11 QuicServerId::QuicServerId() {} 11 QuicServerId::QuicServerId() {
12 }
12 13
13 QuicServerId::QuicServerId(const HostPortPair& host_port_pair, 14 QuicServerId::QuicServerId(const HostPortPair& host_port_pair,
14 bool is_https, 15 bool is_https,
15 PrivacyMode privacy_mode) 16 PrivacyMode privacy_mode)
16 : host_port_pair_(host_port_pair), 17 : host_port_pair_(host_port_pair),
17 is_https_(is_https), 18 is_https_(is_https),
18 privacy_mode_(privacy_mode) {} 19 privacy_mode_(privacy_mode) {
20 }
21
22 QuicServerId::QuicServerId(const string& host, uint16 port, bool is_https)
23 : host_port_pair_(host, port),
24 is_https_(is_https),
25 privacy_mode_(PRIVACY_MODE_DISABLED) {
26 }
19 27
20 QuicServerId::QuicServerId(const string& host, 28 QuicServerId::QuicServerId(const string& host,
21 uint16 port, 29 uint16 port,
22 bool is_https)
23 : host_port_pair_(host, port),
24 is_https_(is_https),
25 privacy_mode_(PRIVACY_MODE_DISABLED) {}
26
27 QuicServerId::QuicServerId(const string& host,
28 uint16 port,
29 bool is_https, 30 bool is_https,
30 PrivacyMode privacy_mode) 31 PrivacyMode privacy_mode)
31 : host_port_pair_(host, port), 32 : host_port_pair_(host, port),
32 is_https_(is_https), 33 is_https_(is_https),
33 privacy_mode_(privacy_mode) {} 34 privacy_mode_(privacy_mode) {
35 }
34 36
35 QuicServerId::~QuicServerId() {} 37 QuicServerId::~QuicServerId() {
38 }
36 39
37 bool QuicServerId::operator<(const QuicServerId& other) const { 40 bool QuicServerId::operator<(const QuicServerId& other) const {
38 if (!host_port_pair_.Equals(other.host_port_pair_)) { 41 if (!host_port_pair_.Equals(other.host_port_pair_)) {
39 return host_port_pair_ < other.host_port_pair_; 42 return host_port_pair_ < other.host_port_pair_;
40 } 43 }
41 if (is_https_ != other.is_https_) { 44 if (is_https_ != other.is_https_) {
42 return is_https_ < other.is_https_; 45 return is_https_ < other.is_https_;
43 } 46 }
44 return privacy_mode_ < other.privacy_mode_; 47 return privacy_mode_ < other.privacy_mode_;
45 } 48 }
46 49
47 bool QuicServerId::operator==(const QuicServerId& other) const { 50 bool QuicServerId::operator==(const QuicServerId& other) const {
48 return is_https_ == other.is_https_ && 51 return is_https_ == other.is_https_ && privacy_mode_ == other.privacy_mode_ &&
49 privacy_mode_ == other.privacy_mode_ && 52 host_port_pair_.Equals(other.host_port_pair_);
50 host_port_pair_.Equals(other.host_port_pair_);
51 } 53 }
52 54
53 string QuicServerId::ToString() const { 55 string QuicServerId::ToString() const {
54 return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString() + 56 return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString() +
55 (privacy_mode_ == PRIVACY_MODE_ENABLED ? "/private" : ""); 57 (privacy_mode_ == PRIVACY_MODE_ENABLED ? "/private" : "");
56 } 58 }
57 59
58 } // namespace net 60 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698