Fix link in German terms of service.
[chromium-blink-merge.git] / content / shell / browser / layout_test / layout_test_browser_context.cc
blobbe19bb268813b60504fa8e36303cc36c158b8115
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_browser_context.h"
7 #include "base/bind.h"
8 #include "base/command_line.h"
9 #include "base/files/file_util.h"
10 #include "base/logging.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/push_messaging_service.h"
13 #include "content/public/browser/resource_context.h"
14 #include "content/shell/browser/layout_test/layout_test_download_manager_delegate.h"
15 #include "content/shell/browser/layout_test/layout_test_permission_manager.h"
16 #include "content/shell/browser/layout_test/layout_test_push_messaging_service.h"
17 #include "content/shell/browser/layout_test/layout_test_url_request_context_getter.h"
18 #include "content/shell/browser/shell_url_request_context_getter.h"
20 #if defined(OS_WIN)
21 #include "base/base_paths_win.h"
22 #elif defined(OS_LINUX)
23 #include "base/nix/xdg_util.h"
24 #elif defined(OS_MACOSX)
25 #include "base/base_paths_mac.h"
26 #endif
28 namespace content {
30 LayoutTestBrowserContext::LayoutTestBrowserContext(bool off_the_record,
31 net::NetLog* net_log)
32 : ShellBrowserContext(off_the_record, net_log) {
33 ignore_certificate_errors_ = true;
36 LayoutTestBrowserContext::~LayoutTestBrowserContext() {
39 ShellURLRequestContextGetter*
40 LayoutTestBrowserContext::CreateURLRequestContextGetter(
41 ProtocolHandlerMap* protocol_handlers,
42 URLRequestInterceptorScopedVector request_interceptors) {
43 return new LayoutTestURLRequestContextGetter(
44 ignore_certificate_errors(),
45 GetPath(),
46 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
47 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
48 protocol_handlers,
49 request_interceptors.Pass(),
50 net_log());
53 DownloadManagerDelegate*
54 LayoutTestBrowserContext::GetDownloadManagerDelegate() {
55 if (!download_manager_delegate_) {
56 download_manager_delegate_.reset(new LayoutTestDownloadManagerDelegate());
57 download_manager_delegate_->SetDownloadManager(
58 BrowserContext::GetDownloadManager(this));
59 download_manager_delegate_->SetDownloadBehaviorForTesting(
60 GetPath().Append(FILE_PATH_LITERAL("downloads")));
63 return download_manager_delegate_.get();
66 PushMessagingService* LayoutTestBrowserContext::GetPushMessagingService() {
67 if (!push_messaging_service_)
68 push_messaging_service_.reset(new LayoutTestPushMessagingService());
69 return push_messaging_service_.get();
72 PermissionManager* LayoutTestBrowserContext::GetPermissionManager() {
73 if (!permission_manager_.get())
74 permission_manager_.reset(new LayoutTestPermissionManager());
75 return permission_manager_.get();
78 LayoutTestPermissionManager*
79 LayoutTestBrowserContext::GetLayoutTestPermissionManager() {
80 return static_cast<LayoutTestPermissionManager*>(GetPermissionManager());
83 } // namespace content