blob: 0cb301cf9f2ac77b0b5151549f48bc65e9f85325 [file] [log] [blame]
// Copyright 2018 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.
#include "fuchsia/engine/browser/web_engine_content_browser_client.h"
#include <utility>
#include "components/version_info/version_info.h"
#include "content/public/common/user_agent.h"
#include "content/public/common/web_preferences.h"
#include "fuchsia/engine/browser/web_engine_browser_context.h"
#include "fuchsia/engine/browser/web_engine_browser_main_parts.h"
#include "fuchsia/engine/browser/web_engine_devtools_manager_delegate.h"
WebEngineContentBrowserClient::WebEngineContentBrowserClient(
fidl::InterfaceRequest<fuchsia::web::Context> request)
: request_(std::move(request)) {}
WebEngineContentBrowserClient::~WebEngineContentBrowserClient() = default;
content::BrowserMainParts*
WebEngineContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) {
DCHECK(request_);
main_parts_ = new WebEngineBrowserMainParts(std::move(request_));
return main_parts_;
}
content::DevToolsManagerDelegate*
WebEngineContentBrowserClient::GetDevToolsManagerDelegate() {
DCHECK(main_parts_);
DCHECK(main_parts_->browser_context());
return new WebEngineDevToolsManagerDelegate(main_parts_->browser_context());
}
std::string WebEngineContentBrowserClient::GetProduct() const {
return version_info::GetProductNameAndVersionForUserAgent();
}
std::string WebEngineContentBrowserClient::GetUserAgent() const {
return content::BuildUserAgentFromProduct(
version_info::GetProductNameAndVersionForUserAgent());
}
void WebEngineContentBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* rvh,
content::WebPreferences* web_prefs) {
// Disable WebSQL support since it's being removed from the web platform.
web_prefs->databases_enabled = false;
}