2012-10-18 00:45:49 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2012-10-08 19:47:37 +02:00
|
|
|
|
2015-11-26 03:53:12 +01:00
|
|
|
#include "libcef/browser/net/chrome_scheme_handler.h"
|
2012-10-18 00:45:49 +02:00
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
#include <algorithm>
|
2012-10-08 19:47:37 +02:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2016-01-06 20:20:54 +01:00
|
|
|
#include <utility>
|
2012-10-18 00:45:49 +02:00
|
|
|
|
2012-10-08 19:47:37 +02:00
|
|
|
#include "include/cef_version.h"
|
|
|
|
#include "include/cef_web_plugin.h"
|
2017-08-04 00:55:19 +02:00
|
|
|
#include "libcef/browser/extensions/chrome_api_registration.h"
|
2012-10-18 00:45:49 +02:00
|
|
|
#include "libcef/browser/frame_host_impl.h"
|
2015-11-26 03:53:12 +01:00
|
|
|
#include "libcef/browser/net/internal_scheme_handler.h"
|
|
|
|
#include "libcef/browser/net/url_request_manager.h"
|
2012-10-18 00:45:49 +02:00
|
|
|
#include "libcef/browser/thread_util.h"
|
2013-04-16 00:16:01 +02:00
|
|
|
#include "libcef/common/content_client.h"
|
2012-10-18 00:45:49 +02:00
|
|
|
|
2012-10-08 19:47:37 +02:00
|
|
|
#include "base/command_line.h"
|
2014-11-12 20:25:15 +01:00
|
|
|
#include "base/files/file_util.h"
|
2016-11-07 20:14:09 +01:00
|
|
|
#include "base/lazy_instance.h"
|
2012-10-18 00:45:49 +02:00
|
|
|
#include "base/logging.h"
|
2016-04-27 22:38:52 +02:00
|
|
|
#include "base/memory/ptr_util.h"
|
2012-10-08 19:47:37 +02:00
|
|
|
#include "base/path_service.h"
|
2013-06-22 04:06:32 +02:00
|
|
|
#include "base/strings/string_util.h"
|
|
|
|
#include "base/strings/stringprintf.h"
|
|
|
|
#include "base/strings/utf_string_conversions.h"
|
2012-10-18 00:45:49 +02:00
|
|
|
#include "base/values.h"
|
2016-07-14 03:35:07 +02:00
|
|
|
#include "cef/grit/cef_resources.h"
|
2016-11-07 20:14:09 +01:00
|
|
|
#include "chrome/browser/browser_about_handler.h"
|
|
|
|
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
|
|
|
|
#include "chrome/common/url_constants.h"
|
2016-12-12 11:05:29 +01:00
|
|
|
#include "content/browser/frame_host/debug_urls.h"
|
2016-11-07 20:14:09 +01:00
|
|
|
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
|
|
|
#include "content/public/browser/browser_url_handler.h"
|
2013-03-12 21:23:24 +01:00
|
|
|
#include "content/public/common/url_constants.h"
|
2017-12-07 22:44:24 +01:00
|
|
|
#include "content/public/common/url_utils.h"
|
2014-04-04 18:50:38 +02:00
|
|
|
#include "content/public/common/user_agent.h"
|
2012-10-18 00:45:49 +02:00
|
|
|
#include "ipc/ipc_channel.h"
|
2013-03-12 21:23:24 +01:00
|
|
|
#include "net/url_request/url_request.h"
|
2012-10-08 19:47:37 +02:00
|
|
|
#include "v8/include/v8.h"
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
using extensions::api::cef::kSupportedAPIs;
|
|
|
|
|
2012-10-08 19:47:37 +02:00
|
|
|
namespace scheme {
|
|
|
|
|
|
|
|
const char kChromeURL[] = "chrome://";
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
const char kChromeUIExtensionsSupportHost[] = "extensions-support";
|
2016-11-07 20:14:09 +01:00
|
|
|
const char kChromeUILicenseHost[] = "license";
|
|
|
|
const char kChromeUIWebUIHostsHost[] = "webui-hosts";
|
|
|
|
|
|
|
|
// Chrome hosts implemented by WebUI.
|
|
|
|
// Some WebUI handlers have Chrome dependencies that may fail in CEF without
|
|
|
|
// additional changes. Do not add new hosts to this list without also manually
|
|
|
|
// testing all related functionality in CEF.
|
|
|
|
const char* kAllowedWebUIHosts[] = {
|
2017-05-17 11:29:28 +02:00
|
|
|
content::kChromeUIAppCacheInternalsHost,
|
|
|
|
content::kChromeUIAccessibilityHost,
|
|
|
|
content::kChromeUIBlobInternalsHost,
|
|
|
|
chrome::kChromeUICreditsHost,
|
|
|
|
content::kChromeUIGpuHost,
|
|
|
|
content::kChromeUIHistogramHost,
|
|
|
|
content::kChromeUIIndexedDBInternalsHost,
|
|
|
|
content::kChromeUIMediaInternalsHost,
|
|
|
|
chrome::kChromeUINetExportHost,
|
|
|
|
chrome::kChromeUINetInternalsHost,
|
|
|
|
content::kChromeUINetworkErrorHost,
|
|
|
|
content::kChromeUINetworkErrorsListingHost,
|
|
|
|
content::kChromeUIResourcesHost,
|
|
|
|
content::kChromeUIServiceWorkerInternalsHost,
|
|
|
|
chrome::kChromeUISystemInfoHost,
|
|
|
|
content::kChromeUITracingHost,
|
|
|
|
content::kChromeUIWebRTCInternalsHost,
|
2016-11-07 20:14:09 +01:00
|
|
|
};
|
2012-10-08 19:47:37 +02:00
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
// Hosts that don't have useful output when linked directly. They'll be excluded
|
|
|
|
// from the "chrome://webui-hosts" listing.
|
|
|
|
const char* kUnlistedHosts[] = {
|
2017-05-17 11:29:28 +02:00
|
|
|
content::kChromeUINetworkErrorHost, content::kChromeUIResourcesHost,
|
2016-12-12 11:05:29 +01:00
|
|
|
};
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
enum ChromeHostId {
|
2012-10-08 19:47:37 +02:00
|
|
|
CHROME_UNKNOWN = 0,
|
2017-08-04 00:55:19 +02:00
|
|
|
CHROME_EXTENSIONS_SUPPORT,
|
2012-10-08 19:47:37 +02:00
|
|
|
CHROME_LICENSE,
|
|
|
|
CHROME_VERSION,
|
2016-11-07 20:14:09 +01:00
|
|
|
CHROME_WEBUI_HOSTS,
|
2012-10-08 19:47:37 +02:00
|
|
|
};
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
// Chrome hosts implemented by CEF.
|
|
|
|
const struct {
|
|
|
|
const char* host;
|
|
|
|
ChromeHostId host_id;
|
|
|
|
} kAllowedCefHosts[] = {
|
2017-08-04 00:55:19 +02:00
|
|
|
{kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT},
|
2017-05-17 11:29:28 +02:00
|
|
|
{kChromeUILicenseHost, CHROME_LICENSE},
|
|
|
|
{chrome::kChromeUIVersionHost, CHROME_VERSION},
|
|
|
|
{kChromeUIWebUIHostsHost, CHROME_WEBUI_HOSTS},
|
2016-11-07 20:14:09 +01:00
|
|
|
};
|
2012-10-08 19:47:37 +02:00
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
ChromeHostId GetChromeHostId(const std::string& host) {
|
2017-05-17 11:29:28 +02:00
|
|
|
for (size_t i = 0; i < sizeof(kAllowedCefHosts) / sizeof(kAllowedCefHosts[0]);
|
|
|
|
++i) {
|
2016-11-07 20:14:09 +01:00
|
|
|
if (base::EqualsCaseInsensitiveASCII(kAllowedCefHosts[i].host,
|
|
|
|
host.c_str())) {
|
|
|
|
return kAllowedCefHosts[i].host_id;
|
|
|
|
}
|
2012-10-08 19:47:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return CHROME_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
// Returns CEF and WebUI hosts. Does not include chrome debug hosts (for
|
|
|
|
// crashing, etc).
|
2016-11-07 20:14:09 +01:00
|
|
|
void GetAllowedHosts(std::vector<std::string>* hosts) {
|
2016-12-12 11:05:29 +01:00
|
|
|
// Hosts implemented by CEF.
|
2017-05-17 11:29:28 +02:00
|
|
|
for (size_t i = 0; i < sizeof(kAllowedCefHosts) / sizeof(kAllowedCefHosts[0]);
|
|
|
|
++i) {
|
2016-11-07 20:14:09 +01:00
|
|
|
hosts->push_back(kAllowedCefHosts[i].host);
|
|
|
|
}
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
// Explicitly whitelisted WebUI hosts.
|
2016-11-07 20:14:09 +01:00
|
|
|
for (size_t i = 0;
|
|
|
|
i < sizeof(kAllowedWebUIHosts) / sizeof(kAllowedWebUIHosts[0]); ++i) {
|
|
|
|
hosts->push_back(kAllowedWebUIHosts[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
// Returns true if a host should not be listed on "chrome://webui-hosts".
|
|
|
|
bool IsUnlistedHost(const std::string& host) {
|
2017-05-17 11:29:28 +02:00
|
|
|
for (size_t i = 0; i < sizeof(kUnlistedHosts) / sizeof(kUnlistedHosts[0]);
|
|
|
|
++i) {
|
2016-12-12 11:05:29 +01:00
|
|
|
if (host == kUnlistedHosts[i])
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if a host is WebUI and should be allowed to load.
|
|
|
|
bool IsAllowedWebUIHost(const std::string& host) {
|
|
|
|
// Explicitly whitelisted WebUI hosts.
|
|
|
|
for (size_t i = 0;
|
2017-05-17 11:29:28 +02:00
|
|
|
i < sizeof(kAllowedWebUIHosts) / sizeof(kAllowedWebUIHosts[0]); ++i) {
|
|
|
|
if (base::EqualsCaseInsensitiveASCII(kAllowedWebUIHosts[i], host.c_str())) {
|
2016-12-12 11:05:29 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Additional debug URLs that are not included in chrome::kChromeDebugURLs.
|
|
|
|
const char* kAllowedDebugURLs[] = {
|
2017-05-17 11:29:28 +02:00
|
|
|
content::kChromeUIBrowserCrashURL,
|
2016-12-12 11:05:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// Returns true for debug URLs that receive special handling (for crashes, etc).
|
|
|
|
bool IsDebugURL(const GURL& url) {
|
|
|
|
// URLs handled by the renderer process in
|
|
|
|
// content/renderer/render_frame_impl.cc MaybeHandleDebugURL().
|
|
|
|
if (content::IsRendererDebugURL(url))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Also include URLs handled by the browser process in
|
|
|
|
// content/browser/frame_host/debug_urls.cc HandleDebugURL().
|
2017-12-07 22:44:24 +01:00
|
|
|
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
2016-12-12 11:05:29 +01:00
|
|
|
GURL host(chrome::kChromeDebugURLs[i]);
|
|
|
|
if (url.GetOrigin() == host.GetOrigin())
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0;
|
|
|
|
i < sizeof(kAllowedDebugURLs) / sizeof(kAllowedDebugURLs[0]); ++i) {
|
|
|
|
GURL host(kAllowedDebugURLs[i]);
|
|
|
|
if (url.GetOrigin() == host.GetOrigin())
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetDebugURLs(std::vector<std::string>* urls) {
|
2017-12-07 22:44:24 +01:00
|
|
|
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
2016-12-12 11:05:29 +01:00
|
|
|
urls->push_back(chrome::kChromeDebugURLs[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0;
|
|
|
|
i < sizeof(kAllowedDebugURLs) / sizeof(kAllowedDebugURLs[0]); ++i) {
|
|
|
|
urls->push_back(kAllowedDebugURLs[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
// Intercepts all WebUI calls and either blocks them or forwards them to the
|
|
|
|
// Content or Chrome WebUI factory as appropriate.
|
|
|
|
class CefWebUIControllerFactory : public content::WebUIControllerFactory {
|
|
|
|
public:
|
|
|
|
// Returns true if WebUI is allowed to handle the specified |url|.
|
|
|
|
static bool AllowWebUIForURL(const GURL& url) {
|
|
|
|
if (!url.SchemeIs(content::kChromeUIScheme))
|
|
|
|
return false;
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
if (IsAllowedWebUIHost(url.host()))
|
|
|
|
return true;
|
2016-11-07 20:14:09 +01:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
content::WebUIController* CreateWebUIControllerForURL(
|
|
|
|
content::WebUI* web_ui,
|
|
|
|
const GURL& url) const override {
|
|
|
|
content::WebUIController* controller = nullptr;
|
|
|
|
if (!AllowWebUIForURL(url))
|
|
|
|
return controller;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
controller = content::ContentWebUIControllerFactory::GetInstance()
|
|
|
|
->CreateWebUIControllerForURL(web_ui, url);
|
2016-11-07 20:14:09 +01:00
|
|
|
if (controller != nullptr)
|
|
|
|
return controller;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
controller = ChromeWebUIControllerFactory::GetInstance()
|
|
|
|
->CreateWebUIControllerForURL(web_ui, url);
|
2016-11-07 20:14:09 +01:00
|
|
|
if (controller != nullptr)
|
|
|
|
return controller;
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
|
|
|
|
const GURL& url) const override {
|
|
|
|
content::WebUI::TypeID type = content::WebUI::kNoWebUI;
|
|
|
|
if (!AllowWebUIForURL(url))
|
|
|
|
return type;
|
|
|
|
|
|
|
|
type = content::ContentWebUIControllerFactory::GetInstance()->GetWebUIType(
|
|
|
|
browser_context, url);
|
|
|
|
if (type != content::WebUI::kNoWebUI)
|
|
|
|
return type;
|
|
|
|
|
|
|
|
type = ChromeWebUIControllerFactory::GetInstance()->GetWebUIType(
|
|
|
|
browser_context, url);
|
|
|
|
if (type != content::WebUI::kNoWebUI)
|
|
|
|
return type;
|
|
|
|
|
|
|
|
return content::WebUI::kNoWebUI;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UseWebUIForURL(content::BrowserContext* browser_context,
|
|
|
|
const GURL& url) const override {
|
|
|
|
if (!AllowWebUIForURL(url))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (content::ContentWebUIControllerFactory::GetInstance()->UseWebUIForURL(
|
|
|
|
browser_context, url) ||
|
|
|
|
ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL(
|
|
|
|
browser_context, url)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
|
|
|
|
const GURL& url) const override {
|
|
|
|
if (!AllowWebUIForURL(url))
|
|
|
|
return false;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
if (content::ContentWebUIControllerFactory::GetInstance()
|
|
|
|
->UseWebUIBindingsForURL(browser_context, url) ||
|
2016-11-07 20:14:09 +01:00
|
|
|
ChromeWebUIControllerFactory::GetInstance()->UseWebUIBindingsForURL(
|
|
|
|
browser_context, url)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) {
|
|
|
|
// about: handler. Must come before chrome: handler, since it will
|
|
|
|
// rewrite about: urls to chrome: URLs and then expect chrome: to
|
|
|
|
// actually handle them. Also relies on a preliminary fixup phase.
|
|
|
|
handler->SetFixupHandler(&FixupBrowserAboutURL);
|
|
|
|
handler->AddHandlerPair(&WillHandleBrowserAboutURL,
|
|
|
|
content::BrowserURLHandler::null_handler());
|
|
|
|
|
|
|
|
// chrome: & friends.
|
|
|
|
handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse);
|
|
|
|
}
|
|
|
|
|
|
|
|
static CefWebUIControllerFactory* GetInstance();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CefWebUIControllerFactory() {}
|
|
|
|
~CefWebUIControllerFactory() override {}
|
|
|
|
|
|
|
|
private:
|
2017-04-20 21:28:17 +02:00
|
|
|
friend struct base::LazyInstanceTraitsBase<CefWebUIControllerFactory>;
|
2016-11-07 20:14:09 +01:00
|
|
|
|
|
|
|
// From chrome/browser/chrome_content_browser_client.cc
|
|
|
|
|
|
|
|
// Returns a copy of the given url with its host set to given host and path
|
|
|
|
// set to given path. Other parts of the url will be the same.
|
|
|
|
static GURL ReplaceURLHostAndPath(const GURL& url,
|
|
|
|
const std::string& host,
|
|
|
|
const std::string& path) {
|
|
|
|
url::Replacements<char> replacements;
|
|
|
|
replacements.SetHost(host.c_str(), url::Component(0, host.length()));
|
|
|
|
replacements.SetPath(path.c_str(), url::Component(0, path.length()));
|
|
|
|
return url.ReplaceComponents(replacements);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Maps "foo://bar/baz/" to "foo://chrome/bar/baz/".
|
|
|
|
static GURL AddUberHost(const GURL& url) {
|
|
|
|
const std::string uber_host = chrome::kChromeUIUberHost;
|
|
|
|
std::string new_path;
|
|
|
|
url.host_piece().AppendToString(&new_path);
|
|
|
|
url.path_piece().AppendToString(&new_path);
|
|
|
|
|
|
|
|
return ReplaceURLHostAndPath(url, uber_host, new_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If url->host() is "chrome" and url->path() has characters other than the
|
|
|
|
// first slash, changes the url from "foo://chrome/bar/" to "foo://bar/" and
|
|
|
|
// returns true. Otherwise returns false.
|
|
|
|
static bool RemoveUberHost(GURL* url) {
|
|
|
|
if (url->host() != chrome::kChromeUIUberHost)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (url->path().empty() || url->path() == "/")
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const std::string old_path = url->path();
|
|
|
|
|
|
|
|
const std::string::size_type separator = old_path.find('/', 1);
|
|
|
|
std::string new_host;
|
|
|
|
std::string new_path;
|
|
|
|
if (separator == std::string::npos) {
|
|
|
|
new_host = old_path.substr(1);
|
|
|
|
} else {
|
|
|
|
new_host = old_path.substr(1, separator - 1);
|
|
|
|
new_path = old_path.substr(separator);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do not allow URLs with paths empty before the first slash since we can't
|
|
|
|
// have an empty host. (e.g "foo://chrome//")
|
|
|
|
if (new_host.empty())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*url = ReplaceURLHostAndPath(*url, new_host, new_path);
|
|
|
|
|
|
|
|
DCHECK(url->is_valid());
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handles rewriting Web UI URLs.
|
|
|
|
static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
|
|
|
|
// Do not handle special URLs such as "about:foo"
|
|
|
|
if (!url->host().empty()) {
|
|
|
|
const GURL chrome_url = AddUberHost(*url);
|
|
|
|
|
|
|
|
// Handle valid "chrome://chrome/foo" URLs so the reverse handler will
|
|
|
|
// be called.
|
|
|
|
if (GetInstance()->UseWebUIForURL(browser_context, chrome_url))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!GetInstance()->UseWebUIForURL(browser_context, *url))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to
|
|
|
|
// "chrome://foo/".
|
|
|
|
static bool HandleWebUIReverse(GURL* url,
|
|
|
|
content::BrowserContext* browser_context) {
|
|
|
|
if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return RemoveUberHost(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefWebUIControllerFactory);
|
|
|
|
};
|
|
|
|
|
|
|
|
base::LazyInstance<CefWebUIControllerFactory>::Leaky
|
|
|
|
g_web_ui_controller_factory = LAZY_INSTANCE_INITIALIZER;
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefWebUIControllerFactory* CefWebUIControllerFactory::GetInstance() {
|
|
|
|
return &g_web_ui_controller_factory.Get();
|
|
|
|
}
|
|
|
|
|
2012-10-08 19:47:37 +02:00
|
|
|
std::string GetOSType() {
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
return "Windows";
|
|
|
|
#elif defined(OS_MACOSX)
|
|
|
|
return "Mac OS X";
|
|
|
|
#elif defined(OS_CHROMEOS)
|
|
|
|
return "Chromium OS";
|
|
|
|
#elif defined(OS_ANDROID)
|
|
|
|
return "Android";
|
|
|
|
#elif defined(OS_LINUX)
|
|
|
|
return "Linux";
|
|
|
|
#elif defined(OS_FREEBSD)
|
|
|
|
return "FreeBSD";
|
|
|
|
#elif defined(OS_OPENBSD)
|
|
|
|
return "OpenBSD";
|
|
|
|
#elif defined(OS_SOLARIS)
|
|
|
|
return "Solaris";
|
|
|
|
#else
|
|
|
|
return "Unknown";
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetCommandLine() {
|
|
|
|
#if defined(OS_WIN)
|
2014-01-02 23:41:11 +01:00
|
|
|
return base::WideToUTF8(
|
2015-01-09 18:22:10 +01:00
|
|
|
base::CommandLine::ForCurrentProcess()->GetCommandLineString());
|
2012-10-08 19:47:37 +02:00
|
|
|
#elif defined(OS_POSIX)
|
|
|
|
std::string command_line = "";
|
|
|
|
typedef std::vector<std::string> ArgvList;
|
2015-01-09 18:22:10 +01:00
|
|
|
const ArgvList& argv = base::CommandLine::ForCurrentProcess()->argv();
|
2012-10-08 19:47:37 +02:00
|
|
|
for (ArgvList::const_iterator iter = argv.begin(); iter != argv.end(); iter++)
|
|
|
|
command_line += " " + *iter;
|
|
|
|
// TODO(viettrungluu): |command_line| could really have any encoding, whereas
|
|
|
|
// below we assumes it's UTF-8.
|
|
|
|
return command_line;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetModulePath() {
|
2013-02-23 01:43:28 +01:00
|
|
|
base::FilePath path;
|
2018-05-14 13:24:05 +02:00
|
|
|
if (base::PathService::Get(base::FILE_MODULE, &path))
|
2012-10-08 19:47:37 +02:00
|
|
|
return CefString(path.value());
|
|
|
|
return std::string();
|
|
|
|
}
|
|
|
|
|
|
|
|
class TemplateParser {
|
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
TemplateParser() : ident_start_("$$"), ident_end_("$$") {}
|
2012-10-08 19:47:37 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
TemplateParser(const std::string& ident_start, const std::string& ident_end)
|
|
|
|
: ident_start_(ident_start), ident_end_(ident_end) {}
|
2012-10-08 19:47:37 +02:00
|
|
|
|
|
|
|
void Add(const std::string& key, const std::string& value) {
|
|
|
|
values_.insert(std::make_pair(key, value));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Parse(std::string* tmpl) {
|
|
|
|
int start_pos, end_pos = 0;
|
|
|
|
int ident_start_len = ident_start_.length();
|
|
|
|
int ident_end_len = ident_end_.length();
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
while (true) {
|
2012-10-08 19:47:37 +02:00
|
|
|
start_pos = tmpl->find(ident_start_, end_pos);
|
|
|
|
if (start_pos >= 0) {
|
|
|
|
end_pos = tmpl->find(ident_end_, start_pos + ident_start_len);
|
|
|
|
if (end_pos >= 0) {
|
|
|
|
// Found an identifier. Check if a substitution exists.
|
|
|
|
std::string key = tmpl->substr(start_pos + ident_start_len,
|
|
|
|
end_pos - start_pos - ident_start_len);
|
|
|
|
KeyMap::const_iterator it = values_.find(key);
|
|
|
|
if (it != values_.end()) {
|
|
|
|
// Peform the substitution.
|
|
|
|
tmpl->replace(start_pos, end_pos + ident_end_len - start_pos,
|
2017-05-17 11:29:28 +02:00
|
|
|
it->second);
|
2012-10-08 19:47:37 +02:00
|
|
|
end_pos = start_pos + it->second.length();
|
|
|
|
} else {
|
|
|
|
// Leave the unknown identifier in place.
|
|
|
|
end_pos += ident_end_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (end_pos >= static_cast<int>(tmpl->length()) - ident_start_len -
|
2017-05-17 11:29:28 +02:00
|
|
|
ident_end_len) {
|
2012-10-08 19:47:37 +02:00
|
|
|
// Not enough room remaining for more identifiers.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No end identifier found.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No start identifier found.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef std::map<std::string, std::string> KeyMap;
|
|
|
|
KeyMap values_;
|
|
|
|
std::string ident_start_;
|
|
|
|
std::string ident_end_;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Delegate : public InternalHandlerDelegate {
|
|
|
|
public:
|
|
|
|
Delegate() {}
|
|
|
|
|
2015-03-02 21:25:14 +01:00
|
|
|
bool OnRequest(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2014-11-12 20:25:15 +01:00
|
|
|
Action* action) override {
|
2012-10-08 19:47:37 +02:00
|
|
|
GURL url = GURL(request->GetURL().ToString());
|
|
|
|
std::string path = url.path();
|
|
|
|
if (path.length() > 0)
|
|
|
|
path = path.substr(1);
|
|
|
|
|
|
|
|
bool handled = false;
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
ChromeHostId host_id = GetChromeHostId(url.host());
|
|
|
|
switch (host_id) {
|
2017-08-04 00:55:19 +02:00
|
|
|
case CHROME_EXTENSIONS_SUPPORT:
|
|
|
|
handled = OnExtensionsSupport(action);
|
|
|
|
break;
|
2012-10-08 19:47:37 +02:00
|
|
|
case CHROME_LICENSE:
|
|
|
|
handled = OnLicense(action);
|
|
|
|
break;
|
|
|
|
case CHROME_VERSION:
|
2015-03-02 21:25:14 +01:00
|
|
|
handled = OnVersion(browser, action);
|
2012-10-08 19:47:37 +02:00
|
|
|
break;
|
2016-11-07 20:14:09 +01:00
|
|
|
case CHROME_WEBUI_HOSTS:
|
|
|
|
handled = OnWebUIHosts(action);
|
|
|
|
break;
|
2012-10-08 19:47:37 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
if (!handled && host_id != CHROME_VERSION) {
|
2017-05-17 11:29:28 +02:00
|
|
|
LOG(INFO) << "Reguest for unknown chrome resource: "
|
|
|
|
<< url.spec().c_str();
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
action->redirect_url =
|
|
|
|
GURL(std::string(kChromeURL) + chrome::kChromeUIVersionHost);
|
|
|
|
return true;
|
2012-10-08 19:47:37 +02:00
|
|
|
}
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
return handled;
|
2012-10-08 19:47:37 +02:00
|
|
|
}
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
bool OnExtensionsSupport(Action* action) {
|
|
|
|
static const char kDevURL[] = "https://developer.chrome.com/extensions/";
|
|
|
|
|
|
|
|
std::string html =
|
|
|
|
"<html>\n<head><title>Extensions Support</title></head>\n"
|
|
|
|
"<body bgcolor=\"white\"><h3>Supported Chrome Extensions "
|
|
|
|
"APIs</h3>\nFollow <a "
|
|
|
|
"href=\"https://bitbucket.org/chromiumembedded/cef/issues/1947\" "
|
|
|
|
"target=\"new\">issue #1947</a> for development progress.\n<ul>\n";
|
|
|
|
|
|
|
|
bool has_top_level_name = false;
|
|
|
|
for (size_t i = 0; kSupportedAPIs[i] != nullptr; ++i) {
|
|
|
|
const std::string& api_name = kSupportedAPIs[i];
|
|
|
|
if (api_name.find("Private") != std::string::npos) {
|
|
|
|
// Don't list private APIs.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const size_t dot_pos = api_name.find('.');
|
|
|
|
if (dot_pos == std::string::npos) {
|
|
|
|
if (has_top_level_name) {
|
|
|
|
// End the previous top-level API entry.
|
|
|
|
html += "</ul></li>\n";
|
|
|
|
} else {
|
|
|
|
has_top_level_name = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start a new top-level API entry.
|
|
|
|
html += "<li><a href=\"" + std::string(kDevURL) + api_name +
|
|
|
|
"\" target=\"new\">" + api_name + "</a><ul>\n";
|
|
|
|
} else {
|
|
|
|
// Function name.
|
|
|
|
const std::string& group_name = api_name.substr(0, dot_pos);
|
|
|
|
const std::string& function_name = api_name.substr(dot_pos + 1);
|
|
|
|
html += "\t<li><a href=\"" + std::string(kDevURL) + group_name +
|
|
|
|
"#method-" + function_name + "\" target=\"new\">" + api_name +
|
|
|
|
"</a></li>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (has_top_level_name) {
|
|
|
|
// End the last top-level API entry.
|
|
|
|
html += "</ul></li>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
html += "</ul>\n</body>\n</html>";
|
|
|
|
|
|
|
|
action->mime_type = "text/html";
|
|
|
|
action->stream = CefStreamReader::CreateForData(
|
|
|
|
const_cast<char*>(html.c_str()), html.length());
|
|
|
|
action->stream_size = html.length();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-10-08 19:47:37 +02:00
|
|
|
bool OnLicense(Action* action) {
|
2013-04-16 00:16:01 +02:00
|
|
|
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
2017-05-17 11:29:28 +02:00
|
|
|
IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE);
|
2012-10-08 19:47:37 +02:00
|
|
|
if (piece.empty()) {
|
|
|
|
NOTREACHED() << "Failed to load license txt resource.";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string html = "<html><head><title>License</title></head><body><pre>" +
|
|
|
|
piece.as_string() + "</pre></body></html>";
|
|
|
|
|
|
|
|
action->mime_type = "text/html";
|
2017-05-17 11:29:28 +02:00
|
|
|
action->stream = CefStreamReader::CreateForData(
|
2012-10-08 19:47:37 +02:00
|
|
|
const_cast<char*>(html.c_str()), html.length());
|
|
|
|
action->stream_size = html.length();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool OnVersion(CefRefPtr<CefBrowser> browser, Action* action) {
|
2013-04-16 00:16:01 +02:00
|
|
|
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
2017-05-17 11:29:28 +02:00
|
|
|
IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE);
|
2012-10-08 19:47:37 +02:00
|
|
|
if (piece.empty()) {
|
|
|
|
NOTREACHED() << "Failed to load version html resource.";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
TemplateParser parser;
|
|
|
|
parser.Add("YEAR", MAKE_STRING(COPYRIGHT_YEAR));
|
2015-03-17 00:34:35 +01:00
|
|
|
parser.Add("CEF", CEF_VERSION);
|
2012-10-08 19:47:37 +02:00
|
|
|
parser.Add("CHROMIUM",
|
2017-05-17 11:29:28 +02:00
|
|
|
base::StringPrintf("%d.%d.%d.%d", CHROME_VERSION_MAJOR,
|
|
|
|
CHROME_VERSION_MINOR, CHROME_VERSION_BUILD,
|
|
|
|
CHROME_VERSION_PATCH));
|
2012-10-08 19:47:37 +02:00
|
|
|
parser.Add("OS", GetOSType());
|
2016-07-21 23:21:32 +02:00
|
|
|
parser.Add("WEBKIT", content::GetWebKitVersion());
|
2012-10-08 19:47:37 +02:00
|
|
|
parser.Add("JAVASCRIPT", v8::V8::GetVersion());
|
|
|
|
parser.Add("FLASH", std::string()); // Value populated asynchronously.
|
2014-04-04 18:50:38 +02:00
|
|
|
parser.Add("USERAGENT", CefContentClient::Get()->GetUserAgent());
|
2012-10-08 19:47:37 +02:00
|
|
|
parser.Add("COMMANDLINE", GetCommandLine());
|
|
|
|
parser.Add("MODULEPATH", GetModulePath());
|
2017-05-17 11:29:28 +02:00
|
|
|
parser.Add("CACHEPATH",
|
|
|
|
browser.get()
|
|
|
|
? browser->GetHost()->GetRequestContext()->GetCachePath()
|
|
|
|
: "");
|
2012-10-08 19:47:37 +02:00
|
|
|
|
|
|
|
std::string tmpl = piece.as_string();
|
|
|
|
parser.Parse(&tmpl);
|
|
|
|
|
|
|
|
action->mime_type = "text/html";
|
2017-05-17 11:29:28 +02:00
|
|
|
action->stream = CefStreamReader::CreateForData(
|
2012-10-08 19:47:37 +02:00
|
|
|
const_cast<char*>(tmpl.c_str()), tmpl.length());
|
|
|
|
action->stream_size = tmpl.length();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-11-07 20:14:09 +01:00
|
|
|
|
|
|
|
bool OnWebUIHosts(Action* action) {
|
2017-05-17 11:29:28 +02:00
|
|
|
std::string html =
|
|
|
|
"<html>\n<head><title>WebUI Hosts</title></head>\n"
|
|
|
|
"<body bgcolor=\"white\"><h3>WebUI Hosts</h3>\n<ul>\n";
|
2016-11-07 20:14:09 +01:00
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
std::vector<std::string> list;
|
|
|
|
GetAllowedHosts(&list);
|
|
|
|
std::sort(list.begin(), list.end());
|
2016-11-07 20:14:09 +01:00
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
for (size_t i = 0U; i < list.size(); ++i) {
|
|
|
|
if (IsUnlistedHost(list[i]))
|
|
|
|
continue;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
html += "<li><a href=\"chrome://" + list[i] + "\">chrome://" + list[i] +
|
|
|
|
"</a></li>\n";
|
2016-11-07 20:14:09 +01:00
|
|
|
}
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
list.clear();
|
|
|
|
GetDebugURLs(&list);
|
|
|
|
std::sort(list.begin(), list.end());
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
html +=
|
|
|
|
"</ul>\n<h3>For Debug</h3>\n"
|
2016-12-12 11:05:29 +01:00
|
|
|
"<p>The following pages are for debugging purposes only. Because they "
|
|
|
|
"crash or hang the renderer, they're not linked directly; you can type "
|
|
|
|
"them into the address bar if you need them.</p>\n<ul>\n";
|
|
|
|
for (size_t i = 0U; i < list.size(); ++i) {
|
|
|
|
html += "<li>" + std::string(list[i]) + "</li>\n";
|
|
|
|
}
|
|
|
|
html += "</ul>\n";
|
|
|
|
|
|
|
|
html += "</body>\n</html>";
|
2016-11-07 20:14:09 +01:00
|
|
|
|
|
|
|
action->mime_type = "text/html";
|
2017-05-17 11:29:28 +02:00
|
|
|
action->stream = CefStreamReader::CreateForData(
|
2016-11-07 20:14:09 +01:00
|
|
|
const_cast<char*>(html.c_str()), html.length());
|
|
|
|
action->stream_size = html.length();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2012-10-08 19:47:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void DidFinishChromeVersionLoad(CefRefPtr<CefFrame> frame) {
|
|
|
|
// Retieve Flash version information and update asynchronously.
|
|
|
|
class Visitor : public CefWebPluginInfoVisitor {
|
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
Visitor(CefRefPtr<CefFrame> frame) : frame_(frame) {}
|
2012-10-08 19:47:37 +02:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
bool Visit(CefRefPtr<CefWebPluginInfo> info,
|
2017-05-17 11:29:28 +02:00
|
|
|
int count,
|
|
|
|
int total) override {
|
2012-10-08 19:47:37 +02:00
|
|
|
std::string name = info->GetName();
|
|
|
|
if (name == "Shockwave Flash") {
|
|
|
|
if (frame_->IsValid()) {
|
|
|
|
std::string version = info->GetVersion();
|
|
|
|
frame_->ExecuteJavaScript(
|
|
|
|
"document.getElementById('flash').innerText = '" + version + "';",
|
|
|
|
std::string(), 0);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
CefRefPtr<CefFrame> frame_;
|
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(Visitor);
|
|
|
|
};
|
|
|
|
|
|
|
|
CefVisitWebPluginInfo(new Visitor(frame));
|
|
|
|
}
|
|
|
|
|
2013-03-12 21:23:24 +01:00
|
|
|
// Wrapper for a ChromeProtocolHandler instance from
|
2017-05-17 11:29:28 +02:00
|
|
|
// content/browser/webui/url_data_manager_backend.cc.
|
|
|
|
class ChromeProtocolHandlerWrapper
|
|
|
|
: public net::URLRequestJobFactory::ProtocolHandler {
|
2013-03-12 21:23:24 +01:00
|
|
|
public:
|
2015-03-02 21:25:14 +01:00
|
|
|
ChromeProtocolHandlerWrapper(
|
|
|
|
CefURLRequestManager* request_manager,
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
2015-03-02 21:25:14 +01:00
|
|
|
chrome_protocol_handler)
|
|
|
|
: request_manager_(request_manager),
|
2016-01-06 20:20:54 +01:00
|
|
|
chrome_protocol_handler_(std::move(chrome_protocol_handler)) {
|
2015-03-02 21:25:14 +01:00
|
|
|
DCHECK(request_manager_);
|
2013-03-12 21:23:24 +01:00
|
|
|
}
|
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
net::URLRequestJob* MaybeCreateJob(
|
2013-03-12 21:23:24 +01:00
|
|
|
net::URLRequest* request,
|
2014-11-12 20:25:15 +01:00
|
|
|
net::NetworkDelegate* network_delegate) const override {
|
2016-12-12 11:05:29 +01:00
|
|
|
// Don't handle debug URLs.
|
|
|
|
if (IsDebugURL(request->url()))
|
|
|
|
return nullptr;
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
// Only allow WebUI to handle chrome:// URLs whitelisted by CEF.
|
|
|
|
if (CefWebUIControllerFactory::AllowWebUIForURL(request->url())) {
|
2015-03-02 21:25:14 +01:00
|
|
|
return chrome_protocol_handler_->MaybeCreateJob(request,
|
|
|
|
network_delegate);
|
2013-03-12 21:23:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Use the protocol handler registered with CEF.
|
2015-03-02 21:25:14 +01:00
|
|
|
return request_manager_->GetRequestJob(request, network_delegate);
|
2013-03-12 21:23:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2015-03-02 21:25:14 +01:00
|
|
|
CefURLRequestManager* request_manager_;
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
2015-03-02 21:25:14 +01:00
|
|
|
chrome_protocol_handler_;
|
2013-03-12 21:23:24 +01:00
|
|
|
};
|
|
|
|
|
2012-10-08 19:47:37 +02:00
|
|
|
} // namespace
|
|
|
|
|
2015-03-02 21:25:14 +01:00
|
|
|
void RegisterChromeHandler(CefURLRequestManager* request_manager) {
|
|
|
|
request_manager->AddFactory(
|
2017-05-17 11:29:28 +02:00
|
|
|
content::kChromeUIScheme, std::string(),
|
2016-04-27 22:38:52 +02:00
|
|
|
CreateInternalHandlerFactory(base::WrapUnique(new Delegate())));
|
2012-10-08 19:47:37 +02:00
|
|
|
}
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
void RegisterWebUIControllerFactory() {
|
|
|
|
// Channel all WebUI handling through CefWebUIControllerFactory.
|
|
|
|
content::WebUIControllerFactory::UnregisterFactoryForTesting(
|
|
|
|
content::ContentWebUIControllerFactory::GetInstance());
|
|
|
|
|
|
|
|
content::WebUIControllerFactory::RegisterFactory(
|
|
|
|
CefWebUIControllerFactory::GetInstance());
|
|
|
|
}
|
2012-10-08 19:47:37 +02:00
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) {
|
|
|
|
CefWebUIControllerFactory::BrowserURLHandlerCreated(handler);
|
2012-10-08 19:47:37 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void DidFinishChromeLoad(CefRefPtr<CefFrame> frame, const GURL& validated_url) {
|
2016-11-07 20:14:09 +01:00
|
|
|
ChromeHostId host_id = GetChromeHostId(validated_url.host());
|
|
|
|
switch (host_id) {
|
2012-10-08 19:47:37 +02:00
|
|
|
case CHROME_VERSION:
|
|
|
|
DidFinishChromeVersionLoad(frame);
|
2018-03-20 21:15:08 +01:00
|
|
|
break;
|
2012-10-08 19:47:37 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
2013-03-12 21:23:24 +01:00
|
|
|
WrapChromeProtocolHandler(
|
2015-03-02 21:25:14 +01:00
|
|
|
CefURLRequestManager* request_manager,
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
2013-03-12 21:23:24 +01:00
|
|
|
chrome_protocol_handler) {
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> ret(
|
2015-03-02 21:25:14 +01:00
|
|
|
new ChromeProtocolHandlerWrapper(request_manager,
|
2016-01-06 20:20:54 +01:00
|
|
|
std::move(chrome_protocol_handler)));
|
|
|
|
return ret;
|
2013-03-12 21:23:24 +01:00
|
|
|
}
|
|
|
|
|
2012-10-08 19:47:37 +02:00
|
|
|
} // namespace scheme
|