OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { | 1284 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { |
1285 if (!extension_pref_value_map_.get()) | 1285 if (!extension_pref_value_map_.get()) |
1286 extension_pref_value_map_.reset(new ExtensionPrefValueMap); | 1286 extension_pref_value_map_.reset(new ExtensionPrefValueMap); |
1287 return extension_pref_value_map_.get(); | 1287 return extension_pref_value_map_.get(); |
1288 } | 1288 } |
1289 | 1289 |
1290 void ProfileImpl::CreateQuotaManagerAndClients() { | 1290 void ProfileImpl::CreateQuotaManagerAndClients() { |
1291 if (quota_manager_.get()) { | 1291 if (quota_manager_.get()) { |
1292 DCHECK(file_system_context_.get()); | 1292 DCHECK(file_system_context_.get()); |
1293 DCHECK(db_tracker_.get()); | 1293 DCHECK(db_tracker_.get()); |
| 1294 DCHECK(webkit_context_.get()); |
1294 return; | 1295 return; |
1295 } | 1296 } |
1296 | 1297 |
1297 // All of the clients have to be created and registered with the | 1298 // All of the clients have to be created and registered with the |
1298 // QuotaManager prior to the QuotaManger being used. So we do them | 1299 // QuotaManager prior to the QuotaManger being used. So we do them |
1299 // all together here prior to handing out a reference to anything | 1300 // all together here prior to handing out a reference to anything |
1300 // that utlizes the QuotaManager. | 1301 // that utlizes the QuotaManager. |
1301 quota_manager_ = new quota::QuotaManager( | 1302 quota_manager_ = new quota::QuotaManager( |
1302 IsOffTheRecord(), | 1303 IsOffTheRecord(), |
1303 GetPath(), | 1304 GetPath(), |
1304 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 1305 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
1305 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); | 1306 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); |
1306 | 1307 |
1307 // Each consumer is responsible for registering its QuotaClient during | 1308 // Each consumer is responsible for registering its QuotaClient during |
1308 // its construction. | 1309 // its construction. |
1309 file_system_context_ = CreateFileSystemContext( | 1310 file_system_context_ = CreateFileSystemContext( |
1310 GetPath(), IsOffTheRecord(), | 1311 GetPath(), IsOffTheRecord(), |
1311 GetExtensionSpecialStoragePolicy(), | 1312 GetExtensionSpecialStoragePolicy(), |
1312 quota_manager_->proxy()); | 1313 quota_manager_->proxy()); |
1313 db_tracker_ = new webkit_database::DatabaseTracker( | 1314 db_tracker_ = new webkit_database::DatabaseTracker( |
1314 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), | 1315 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), |
1315 quota_manager_->proxy(), | 1316 quota_manager_->proxy(), |
1316 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 1317 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 1318 webkit_context_ = new WebKitContext( |
| 1319 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), |
| 1320 clear_local_state_on_exit_, quota_manager_->proxy(), |
| 1321 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); |
1317 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 1322 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
1318 BrowserThread::PostTask( | 1323 BrowserThread::PostTask( |
1319 BrowserThread::IO, FROM_HERE, | 1324 BrowserThread::IO, FROM_HERE, |
1320 NewRunnableMethod( | 1325 NewRunnableMethod( |
1321 appcache_service_.get(), | 1326 appcache_service_.get(), |
1322 &ChromeAppCacheService::InitializeOnIOThread, | 1327 &ChromeAppCacheService::InitializeOnIOThread, |
1323 IsOffTheRecord() | 1328 IsOffTheRecord() |
1324 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 1329 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
1325 &GetResourceContext(), | 1330 &GetResourceContext(), |
1326 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), | 1331 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), |
1327 clear_local_state_on_exit_)); | 1332 clear_local_state_on_exit_)); |
1328 } | 1333 } |
1329 | 1334 |
1330 WebKitContext* ProfileImpl::GetWebKitContext() { | 1335 WebKitContext* ProfileImpl::GetWebKitContext() { |
1331 if (!webkit_context_.get()) { | 1336 CreateQuotaManagerAndClients(); |
1332 webkit_context_ = new WebKitContext( | |
1333 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), | |
1334 clear_local_state_on_exit_); | |
1335 } | |
1336 return webkit_context_.get(); | 1337 return webkit_context_.get(); |
1337 } | 1338 } |
1338 | 1339 |
1339 void ProfileImpl::MarkAsCleanShutdown() { | 1340 void ProfileImpl::MarkAsCleanShutdown() { |
1340 if (prefs_.get()) { | 1341 if (prefs_.get()) { |
1341 // The session cleanly exited, set kSessionExitedCleanly appropriately. | 1342 // The session cleanly exited, set kSessionExitedCleanly appropriately. |
1342 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); | 1343 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); |
1343 | 1344 |
1344 // NOTE: If you change what thread this writes on, be sure and update | 1345 // NOTE: If you change what thread this writes on, be sure and update |
1345 // ChromeFrame::EndSession(). | 1346 // ChromeFrame::EndSession(). |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 return pref_proxy_config_tracker_; | 1634 return pref_proxy_config_tracker_; |
1634 } | 1635 } |
1635 | 1636 |
1636 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1637 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { |
1637 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1638 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
1638 return NULL; | 1639 return NULL; |
1639 if (!prerender_manager_.get()) | 1640 if (!prerender_manager_.get()) |
1640 prerender_manager_.reset(new prerender::PrerenderManager(this)); | 1641 prerender_manager_.reset(new prerender::PrerenderManager(this)); |
1641 return prerender_manager_.get(); | 1642 return prerender_manager_.get(); |
1642 } | 1643 } |
OLD | NEW |