OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "storage/common/database/database_identifier.h" | 5 #include "storage/common/database/database_identifier.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "url/url_canon.h" | 9 #include "url/url_canon.h" |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 is_unique_(true), | 109 is_unique_(true), |
110 is_file_(false) { | 110 is_file_(false) { |
111 } | 111 } |
112 | 112 |
113 DatabaseIdentifier::DatabaseIdentifier(const std::string& scheme, | 113 DatabaseIdentifier::DatabaseIdentifier(const std::string& scheme, |
114 const std::string& hostname, | 114 const std::string& hostname, |
115 int port, | 115 int port, |
116 bool is_unique, | 116 bool is_unique, |
117 bool is_file) | 117 bool is_file) |
118 : scheme_(scheme), | 118 : scheme_(scheme), |
119 hostname_(base::StringToLowerASCII(hostname)), | 119 hostname_(base::ToLowerASCII(hostname)), |
120 port_(port), | 120 port_(port), |
121 is_unique_(is_unique), | 121 is_unique_(is_unique), |
122 is_file_(is_file) { | 122 is_file_(is_file) { |
123 } | 123 } |
124 | 124 |
125 DatabaseIdentifier::~DatabaseIdentifier() {} | 125 DatabaseIdentifier::~DatabaseIdentifier() {} |
126 | 126 |
127 std::string DatabaseIdentifier::ToString() const { | 127 std::string DatabaseIdentifier::ToString() const { |
128 if (is_file_) | 128 if (is_file_) |
129 return "file__0"; | 129 return "file__0"; |
130 if (is_unique_) | 130 if (is_unique_) |
131 return "__0"; | 131 return "__0"; |
132 return scheme_ + "_" + hostname_ + "_" + base::IntToString(port_); | 132 return scheme_ + "_" + hostname_ + "_" + base::IntToString(port_); |
133 } | 133 } |
134 | 134 |
135 GURL DatabaseIdentifier::ToOrigin() const { | 135 GURL DatabaseIdentifier::ToOrigin() const { |
136 if (is_file_) | 136 if (is_file_) |
137 return GURL("file:///"); | 137 return GURL("file:///"); |
138 if (is_unique_) | 138 if (is_unique_) |
139 return GURL(); | 139 return GURL(); |
140 if (port_ == 0) | 140 if (port_ == 0) |
141 return GURL(scheme_ + "://" + hostname_); | 141 return GURL(scheme_ + "://" + hostname_); |
142 return GURL(scheme_ + "://" + hostname_ + ":" + base::IntToString(port_)); | 142 return GURL(scheme_ + "://" + hostname_ + ":" + base::IntToString(port_)); |
143 } | 143 } |
144 | 144 |
145 } // namespace storage | 145 } // namespace storage |
OLD | NEW |