This source file includes following definitions.
- OriginToString
- OriginToString16
#include "chrome/common/content_settings_helper.h"
#include "base/strings/string_piece.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/url_constants.h"
#include "url/gurl.h"
namespace content_settings_helper {
std::string OriginToString(const GURL& origin) {
std::string port_component(origin.IntPort() != url_parse::PORT_UNSPECIFIED
? ":" + origin.port()
: std::string());
std::string scheme_component(!origin.SchemeIs(content::kHttpScheme)
? origin.scheme() +
content::kStandardSchemeSeparator
: std::string());
return scheme_component + origin.host() + port_component;
}
base::string16 OriginToString16(const GURL& origin) {
return base::UTF8ToUTF16(OriginToString(origin));
}
}