| // Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights |
| // reserved. Use of this source code is governed by a BSD-style license that |
| // can be found in the LICENSE file. |
| #include "libcef/common/net/url_util.h" |
| #include "base/logging.h" |
| #include "components/url_formatter/url_fixer.h" |
| GURL MakeGURL(const CefString& url, bool fixup) { |
| GURL gurl = GURL(url.ToString()); |
| if (!url.empty() && !gurl.is_valid() && !gurl.has_scheme()) { |
| std::string fixed_scheme(url::kHttpScheme); |
| fixed_scheme.append(url::kStandardSchemeSeparator); |
| std::string new_url = url; |
| new_url.insert(0, fixed_scheme); |
| bool FixupGURL(GURL& gurl) { |
| url_formatter::FixupURL(gurl.possibly_invalid_spec(), std::string()); |
| if (fixup_url.is_valid()) { |
| LOG(ERROR) << "Invalid URL: " << gurl.possibly_invalid_spec(); |