| 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/shell_browser_context.h" | 5 #include "content/shell/browser/shell_browser_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 net_log_(net_log), | 60 net_log_(net_log), |
| 61 guest_manager_(NULL) { | 61 guest_manager_(NULL) { |
| 62 InitWhileIOAllowed(); | 62 InitWhileIOAllowed(); |
| 63 BrowserContextDependencyManager::GetInstance()-> | 63 BrowserContextDependencyManager::GetInstance()-> |
| 64 CreateBrowserContextServices(this); | 64 CreateBrowserContextServices(this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 ShellBrowserContext::~ShellBrowserContext() { | 67 ShellBrowserContext::~ShellBrowserContext() { |
| 68 BrowserContextDependencyManager::GetInstance()-> | 68 BrowserContextDependencyManager::GetInstance()-> |
| 69 DestroyBrowserContextServices(this); | 69 DestroyBrowserContextServices(this); |
| 70 ShutdownStoragePartitions(); | 70 // Need to destruct the ResourceContext before posting tasks which may delete |
| 71 // the URLRequestContext because ResourceContext's destructor will remove any |
| 72 // outstanding request while URLRequestContext's destructor ensures that there |
| 73 // are no more outstanding requests. |
| 71 if (resource_context_) { | 74 if (resource_context_) { |
| 72 BrowserThread::DeleteSoon( | 75 BrowserThread::DeleteSoon( |
| 73 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 76 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
| 74 } | 77 } |
| 78 ShutdownStoragePartitions(); |
| 75 } | 79 } |
| 76 | 80 |
| 77 void ShellBrowserContext::InitWhileIOAllowed() { | 81 void ShellBrowserContext::InitWhileIOAllowed() { |
| 78 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 82 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 79 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) | 83 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) |
| 80 ignore_certificate_errors_ = true; | 84 ignore_certificate_errors_ = true; |
| 81 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { | 85 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| 82 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); | 86 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
| 83 if (base::DirectoryExists(path_) || base::CreateDirectory(path_)) { | 87 if (base::DirectoryExists(path_) || base::CreateDirectory(path_)) { |
| 84 // BrowserContext needs an absolute path, which we would normally get via | 88 // BrowserContext needs an absolute path, which we would normally get via |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 return permission_manager_.get(); | 215 return permission_manager_.get(); |
| 212 } | 216 } |
| 213 | 217 |
| 214 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { | 218 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { |
| 215 if (!background_sync_controller_) | 219 if (!background_sync_controller_) |
| 216 background_sync_controller_.reset(new MockBackgroundSyncController()); | 220 background_sync_controller_.reset(new MockBackgroundSyncController()); |
| 217 return background_sync_controller_.get(); | 221 return background_sync_controller_.get(); |
| 218 } | 222 } |
| 219 | 223 |
| 220 } // namespace content | 224 } // namespace content |
| OLD | NEW |