| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/shell/browser/layout_test/layout_test_browser_main_parts.h" | 5 #include "content/shell/browser/layout_test/layout_test_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/storage_partition.h" | 16 #include "content/public/browser/storage_partition.h" |
| 17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/common/main_function_params.h" | 18 #include "content/public/common/main_function_params.h" |
| 19 #include "content/public/common/url_constants.h" | 19 #include "content/public/common/url_constants.h" |
| 20 #include "content/shell/browser/layout_test/layout_test_browser_context.h" | 20 #include "content/shell/browser/layout_test/layout_test_browser_context.h" |
| 21 #include "content/shell/browser/shell.h" | 21 #include "content/shell/browser/shell.h" |
| 22 #include "content/shell/browser/shell_browser_context.h" | 22 #include "content/shell/browser/shell_browser_context.h" |
| 23 #include "content/shell/browser/shell_devtools_manager_delegate.h" | 23 #include "content/shell/browser/shell_devtools_manager_delegate.h" |
| 24 #include "content/shell/browser/shell_net_log.h" | 24 #include "content/shell/browser/shell_net_log.h" |
| 25 #include "content/shell/common/shell_switches.h" | 25 #include "content/shell/common/shell_switches.h" |
| 26 #include "net/base/filename_util.h" | 26 #include "net/base/filename_util.h" |
| 27 #include "net/base/net_module.h" | 27 #include "net/base/net_module.h" |
| 28 #include "net/grit/net_resources.h" | 28 #include "net/grit/net_resources.h" |
| 29 #include "ppapi/features/features.h" | 29 #include "ppapi/features/features.h" |
| 30 #include "storage/browser/quota/quota_manager.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 31 #include "url/gurl.h" | 32 #include "url/gurl.h" |
| 32 | 33 |
| 33 #if BUILDFLAG(ENABLE_PLUGINS) | 34 #if BUILDFLAG(ENABLE_PLUGINS) |
| 34 #include "content/public/browser/plugin_service.h" | 35 #include "content/public/browser/plugin_service.h" |
| 35 #include "content/shell/browser/shell_plugin_service_filter.h" | 36 #include "content/shell/browser/shell_plugin_service_filter.h" |
| 36 #endif | 37 #endif |
| 37 | 38 |
| 38 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
| 39 #include "components/crash/content/browser/crash_dump_manager_android.h" | 40 #include "components/crash/content/browser/crash_dump_manager_android.h" |
| 40 #include "net/android/network_change_notifier_factory_android.h" | 41 #include "net/android/network_change_notifier_factory_android.h" |
| 41 #include "net/base/network_change_notifier.h" | 42 #include "net/base/network_change_notifier.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 #if defined(USE_AURA) && defined(USE_X11) | 45 #if defined(USE_AURA) && defined(USE_X11) |
| 45 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck | 46 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck |
| 46 #endif | 47 #endif |
| 47 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) | 48 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) |
| 48 #include "ui/base/ime/input_method_initializer.h" | 49 #include "ui/base/ime/input_method_initializer.h" |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 namespace content { | 52 namespace content { |
| 52 | 53 |
| 54 namespace { |
| 55 |
| 56 // Default quota for each origin is 5MB. |
| 57 const int kDefaultLayoutTestQuotaBytes = 5 * 1024 * 1024; |
| 58 |
| 59 } // namespace |
| 60 |
| 53 LayoutTestBrowserMainParts::LayoutTestBrowserMainParts( | 61 LayoutTestBrowserMainParts::LayoutTestBrowserMainParts( |
| 54 const MainFunctionParams& parameters) | 62 const MainFunctionParams& parameters) |
| 55 : ShellBrowserMainParts(parameters) { | 63 : ShellBrowserMainParts(parameters) { |
| 56 } | 64 } |
| 57 | 65 |
| 58 LayoutTestBrowserMainParts::~LayoutTestBrowserMainParts() { | 66 LayoutTestBrowserMainParts::~LayoutTestBrowserMainParts() { |
| 59 } | 67 } |
| 60 | 68 |
| 61 void LayoutTestBrowserMainParts::InitializeBrowserContexts() { | 69 void LayoutTestBrowserMainParts::InitializeBrowserContexts() { |
| 62 set_browser_context(new LayoutTestBrowserContext(false, net_log())); | 70 set_browser_context(new LayoutTestBrowserContext(false, net_log())); |
| 63 set_off_the_record_browser_context(nullptr); | 71 set_off_the_record_browser_context(nullptr); |
| 64 } | 72 } |
| 65 | 73 |
| 66 void LayoutTestBrowserMainParts::InitializeMessageLoopContext() { | 74 void LayoutTestBrowserMainParts::InitializeMessageLoopContext() { |
| 75 storage::QuotaManager* quota_manager = |
| 76 BrowserContext::GetDefaultStoragePartition(browser_context()) |
| 77 ->GetQuotaManager(); |
| 78 BrowserThread::PostTask( |
| 79 BrowserThread::IO, |
| 80 FROM_HERE, |
| 81 base::Bind(&storage::QuotaManager::SetTemporaryGlobalOverrideQuota, |
| 82 quota_manager, |
| 83 kDefaultLayoutTestQuotaBytes * |
| 84 storage::QuotaManager::kPerHostTemporaryPortion, |
| 85 storage::QuotaCallback())); |
| 86 |
| 67 #if BUILDFLAG(ENABLE_PLUGINS) | 87 #if BUILDFLAG(ENABLE_PLUGINS) |
| 68 PluginService* plugin_service = PluginService::GetInstance(); | 88 PluginService* plugin_service = PluginService::GetInstance(); |
| 69 plugin_service_filter_.reset(new ShellPluginServiceFilter); | 89 plugin_service_filter_.reset(new ShellPluginServiceFilter); |
| 70 plugin_service->SetFilter(plugin_service_filter_.get()); | 90 plugin_service->SetFilter(plugin_service_filter_.get()); |
| 71 #endif | 91 #endif |
| 72 } | 92 } |
| 73 | 93 |
| 74 } // namespace | 94 } // namespace |
| OLD | NEW |