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