Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / content / shell / browser / layout_test / layout_test_content_browser_client.cc
blob9039997d14930d7caf01b4d2b8ac00a6d5bb5731
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h"
7 #include "content/public/browser/browser_context.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/navigator_connect_context.h"
10 #include "content/public/browser/render_process_host.h"
11 #include "content/public/browser/storage_partition.h"
12 #include "content/shell/browser/layout_test/layout_test_browser_context.h"
13 #include "content/shell/browser/layout_test/layout_test_message_filter.h"
14 #include "content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h"
15 #include "content/shell/browser/layout_test/layout_test_notification_manager.h"
16 #include "content/shell/browser/shell_browser_context.h"
17 #include "content/shell/common/shell_messages.h"
18 #include "content/shell/renderer/layout_test/blink_test_helpers.h"
20 namespace content {
21 namespace {
23 LayoutTestContentBrowserClient* g_layout_test_browser_client;
25 } // namespace
27 LayoutTestContentBrowserClient::LayoutTestContentBrowserClient() {
28 DCHECK(!g_layout_test_browser_client);
30 layout_test_notification_manager_.reset(new LayoutTestNotificationManager());
32 g_layout_test_browser_client = this;
35 LayoutTestContentBrowserClient::~LayoutTestContentBrowserClient() {
36 g_layout_test_browser_client = nullptr;
39 LayoutTestContentBrowserClient* LayoutTestContentBrowserClient::Get() {
40 return g_layout_test_browser_client;
43 LayoutTestBrowserContext*
44 LayoutTestContentBrowserClient::GetLayoutTestBrowserContext() {
45 return static_cast<LayoutTestBrowserContext*>(browser_context());
48 LayoutTestNotificationManager*
49 LayoutTestContentBrowserClient::GetLayoutTestNotificationManager() {
50 return layout_test_notification_manager_.get();
53 void LayoutTestContentBrowserClient::RenderProcessWillLaunch(
54 RenderProcessHost* host) {
55 ShellContentBrowserClient::RenderProcessWillLaunch(host);
57 StoragePartition* partition =
58 BrowserContext::GetDefaultStoragePartition(browser_context());
59 host->AddFilter(new LayoutTestMessageFilter(
60 host->GetID(),
61 partition->GetDatabaseTracker(),
62 partition->GetQuotaManager(),
63 partition->GetURLRequestContext()));
65 host->Send(new ShellViewMsg_SetWebKitSourceDir(GetWebKitRootDirFilePath()));
68 PlatformNotificationService*
69 LayoutTestContentBrowserClient::GetPlatformNotificationService() {
70 return layout_test_notification_manager_.get();
73 void LayoutTestContentBrowserClient::GetAdditionalNavigatorConnectServices(
74 const scoped_refptr<NavigatorConnectContext>& context) {
75 context->AddFactory(
76 make_scoped_ptr(new LayoutTestNavigatorConnectServiceFactory));
79 } // namespace content