blob: 8e88f5dfb6a19a1d6d5362c72bb9d5d37e969921 [file] [log] [blame]
// Copyright (c) 2015 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 "blimp/engine/app/blimp_content_browser_client.h"
#include "blimp/engine/app/blimp_browser_main_parts.h"
#include "blimp/engine/app/settings_manager.h"
#include "blimp/engine/mojo/blob_channel_service.h"
#include "content/public/common/service_registry.h"
namespace blimp {
namespace engine {
BlimpContentBrowserClient::BlimpContentBrowserClient() {}
BlimpContentBrowserClient::~BlimpContentBrowserClient() {}
content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) {
blimp_browser_main_parts_ = new BlimpBrowserMainParts(parameters);
// BrowserMainLoop takes ownership of the returned BrowserMainParts.
return blimp_browser_main_parts_;
}
void BlimpContentBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* render_view_host,
content::WebPreferences* prefs) {
if (!blimp_browser_main_parts_)
return;
if (!blimp_browser_main_parts_->GetSettingsManager())
return;
blimp_browser_main_parts_->GetSettingsManager()->UpdateWebkitPreferences(
prefs);
}
BlimpBrowserContext* BlimpContentBrowserClient::GetBrowserContext() {
return blimp_browser_main_parts_->GetBrowserContext();
}
void BlimpContentBrowserClient::RegisterRenderProcessMojoServices(
content::ServiceRegistry* registry) {
registry->AddService<mojom::BlobChannel>(
base::Bind(&BlobChannelService::Create));
}
} // namespace engine
} // namespace blimp