| 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 // Need to destruct the ResourceContext before posting tasks which may delete | 70 ShutdownStoragePartitions(); |
| 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. | |
| 74 if (resource_context_) { | 71 if (resource_context_) { |
| 75 BrowserThread::DeleteSoon( | 72 BrowserThread::DeleteSoon( |
| 76 BrowserThread::IO, FROM_HERE, resource_context_.release()); | 73 BrowserThread::IO, FROM_HERE, resource_context_.release()); |
| 77 } | 74 } |
| 78 ShutdownStoragePartitions(); | |
| 79 } | 75 } |
| 80 | 76 |
| 81 void ShellBrowserContext::InitWhileIOAllowed() { | 77 void ShellBrowserContext::InitWhileIOAllowed() { |
| 82 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 78 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 83 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) | 79 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) |
| 84 ignore_certificate_errors_ = true; | 80 ignore_certificate_errors_ = true; |
| 85 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { | 81 if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| 86 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); | 82 path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
| 87 if (base::DirectoryExists(path_) || base::CreateDirectory(path_)) { | 83 if (base::DirectoryExists(path_) || base::CreateDirectory(path_)) { |
| 88 // BrowserContext needs an absolute path, which we would normally get via | 84 // BrowserContext needs an absolute path, which we would normally get via |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return permission_manager_.get(); | 211 return permission_manager_.get(); |
| 216 } | 212 } |
| 217 | 213 |
| 218 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { | 214 BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { |
| 219 if (!background_sync_controller_) | 215 if (!background_sync_controller_) |
| 220 background_sync_controller_.reset(new MockBackgroundSyncController()); | 216 background_sync_controller_.reset(new MockBackgroundSyncController()); |
| 221 return background_sync_controller_.get(); | 217 return background_sync_controller_.get(); |
| 222 } | 218 } |
| 223 | 219 |
| 224 } // namespace content | 220 } // namespace content |
| OLD | NEW |