| 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" | |
| 31 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 33 | 32 |
| 34 #if BUILDFLAG(ENABLE_PLUGINS) | 33 #if BUILDFLAG(ENABLE_PLUGINS) |
| 35 #include "content/public/browser/plugin_service.h" | 34 #include "content/public/browser/plugin_service.h" |
| 36 #include "content/shell/browser/shell_plugin_service_filter.h" | 35 #include "content/shell/browser/shell_plugin_service_filter.h" |
| 37 #endif | 36 #endif |
| 38 | 37 |
| 39 #if defined(OS_ANDROID) | 38 #if defined(OS_ANDROID) |
| 40 #include "components/crash/content/browser/crash_dump_manager_android.h" | 39 #include "components/crash/content/browser/crash_dump_manager_android.h" |
| 41 #include "net/android/network_change_notifier_factory_android.h" | 40 #include "net/android/network_change_notifier_factory_android.h" |
| 42 #include "net/base/network_change_notifier.h" | 41 #include "net/base/network_change_notifier.h" |
| 43 #endif | 42 #endif |
| 44 | 43 |
| 45 #if defined(USE_AURA) && defined(USE_X11) | 44 #if defined(USE_AURA) && defined(USE_X11) |
| 46 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck | 45 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck |
| 47 #endif | 46 #endif |
| 48 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) | 47 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) |
| 49 #include "ui/base/ime/input_method_initializer.h" | 48 #include "ui/base/ime/input_method_initializer.h" |
| 50 #endif | 49 #endif |
| 51 | 50 |
| 52 namespace content { | 51 namespace content { |
| 53 | 52 |
| 54 namespace { | |
| 55 | |
| 56 // Default quota for each origin is 5MB. | |
| 57 const int kDefaultLayoutTestQuotaBytes = 5 * 1024 * 1024; | |
| 58 | |
| 59 } // namespace | |
| 60 | |
| 61 LayoutTestBrowserMainParts::LayoutTestBrowserMainParts( | 53 LayoutTestBrowserMainParts::LayoutTestBrowserMainParts( |
| 62 const MainFunctionParams& parameters) | 54 const MainFunctionParams& parameters) |
| 63 : ShellBrowserMainParts(parameters) { | 55 : ShellBrowserMainParts(parameters) { |
| 64 } | 56 } |
| 65 | 57 |
| 66 LayoutTestBrowserMainParts::~LayoutTestBrowserMainParts() { | 58 LayoutTestBrowserMainParts::~LayoutTestBrowserMainParts() { |
| 67 } | 59 } |
| 68 | 60 |
| 69 void LayoutTestBrowserMainParts::InitializeBrowserContexts() { | 61 void LayoutTestBrowserMainParts::InitializeBrowserContexts() { |
| 70 set_browser_context(new LayoutTestBrowserContext(false, net_log())); | 62 set_browser_context(new LayoutTestBrowserContext(false, net_log())); |
| 71 set_off_the_record_browser_context(nullptr); | 63 set_off_the_record_browser_context(nullptr); |
| 72 } | 64 } |
| 73 | 65 |
| 74 void LayoutTestBrowserMainParts::InitializeMessageLoopContext() { | 66 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 | |
| 87 #if BUILDFLAG(ENABLE_PLUGINS) | 67 #if BUILDFLAG(ENABLE_PLUGINS) |
| 88 PluginService* plugin_service = PluginService::GetInstance(); | 68 PluginService* plugin_service = PluginService::GetInstance(); |
| 89 plugin_service_filter_.reset(new ShellPluginServiceFilter); | 69 plugin_service_filter_.reset(new ShellPluginServiceFilter); |
| 90 plugin_service->SetFilter(plugin_service_filter_.get()); | 70 plugin_service->SetFilter(plugin_service_filter_.get()); |
| 91 #endif | 71 #endif |
| 92 } | 72 } |
| 93 | 73 |
| 94 } // namespace | 74 } // namespace |
| OLD | NEW |