OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/content_settings_helper.h" | 5 #include "chrome/common/content_settings_helper.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "net/base/url_constants.h" |
10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
11 | 12 |
12 namespace content_settings_helper { | 13 namespace content_settings_helper { |
13 | 14 |
14 std::string OriginToString(const GURL& origin) { | 15 std::string OriginToString(const GURL& origin) { |
15 std::string port_component(origin.IntPort() != url_parse::PORT_UNSPECIFIED | 16 std::string port_component(origin.IntPort() != url_parse::PORT_UNSPECIFIED |
16 ? ":" + origin.port() | 17 ? ":" + origin.port() |
17 : std::string()); | 18 : std::string()); |
18 std::string scheme_component(!origin.SchemeIs(content::kHttpScheme) | 19 std::string scheme_component(!origin.SchemeIs(net::kHttpScheme) |
19 ? origin.scheme() + | 20 ? origin.scheme() + |
20 content::kStandardSchemeSeparator | 21 content::kStandardSchemeSeparator |
21 : std::string()); | 22 : std::string()); |
22 return scheme_component + origin.host() + port_component; | 23 return scheme_component + origin.host() + port_component; |
23 } | 24 } |
24 | 25 |
25 base::string16 OriginToString16(const GURL& origin) { | 26 base::string16 OriginToString16(const GURL& origin) { |
26 return base::UTF8ToUTF16(OriginToString(origin)); | 27 return base::UTF8ToUTF16(OriginToString(origin)); |
27 } | 28 } |
28 | 29 |
29 } // namespace content_settings_helper | 30 } // namespace content_settings_helper |
OLD | NEW |