| 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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { | 1296 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { |
| 1297 if (!extension_pref_value_map_.get()) | 1297 if (!extension_pref_value_map_.get()) |
| 1298 extension_pref_value_map_.reset(new ExtensionPrefValueMap); | 1298 extension_pref_value_map_.reset(new ExtensionPrefValueMap); |
| 1299 return extension_pref_value_map_.get(); | 1299 return extension_pref_value_map_.get(); |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 void ProfileImpl::CreateQuotaManagerAndClients() { | 1302 void ProfileImpl::CreateQuotaManagerAndClients() { |
| 1303 if (quota_manager_.get()) { | 1303 if (quota_manager_.get()) { |
| 1304 DCHECK(file_system_context_.get()); | 1304 DCHECK(file_system_context_.get()); |
| 1305 DCHECK(db_tracker_.get()); | 1305 DCHECK(db_tracker_.get()); |
| 1306 DCHECK(webkit_context_.get()); |
| 1306 return; | 1307 return; |
| 1307 } | 1308 } |
| 1308 | 1309 |
| 1309 // All of the clients have to be created and registered with the | 1310 // All of the clients have to be created and registered with the |
| 1310 // QuotaManager prior to the QuotaManger being used. So we do them | 1311 // QuotaManager prior to the QuotaManger being used. So we do them |
| 1311 // all together here prior to handing out a reference to anything | 1312 // all together here prior to handing out a reference to anything |
| 1312 // that utlizes the QuotaManager. | 1313 // that utlizes the QuotaManager. |
| 1313 quota_manager_ = new quota::QuotaManager( | 1314 quota_manager_ = new quota::QuotaManager( |
| 1314 IsOffTheRecord(), | 1315 IsOffTheRecord(), |
| 1315 GetPath(), | 1316 GetPath(), |
| 1316 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 1317 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 1317 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | 1318 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), |
| 1318 GetExtensionSpecialStoragePolicy()); | 1319 GetExtensionSpecialStoragePolicy()); |
| 1319 | 1320 |
| 1320 // Each consumer is responsible for registering its QuotaClient during | 1321 // Each consumer is responsible for registering its QuotaClient during |
| 1321 // its construction. | 1322 // its construction. |
| 1322 file_system_context_ = CreateFileSystemContext( | 1323 file_system_context_ = CreateFileSystemContext( |
| 1323 GetPath(), IsOffTheRecord(), | 1324 GetPath(), IsOffTheRecord(), |
| 1324 GetExtensionSpecialStoragePolicy(), | 1325 GetExtensionSpecialStoragePolicy(), |
| 1325 quota_manager_->proxy()); | 1326 quota_manager_->proxy()); |
| 1326 db_tracker_ = new webkit_database::DatabaseTracker( | 1327 db_tracker_ = new webkit_database::DatabaseTracker( |
| 1327 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), | 1328 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), |
| 1328 quota_manager_->proxy(), | 1329 quota_manager_->proxy(), |
| 1329 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 1330 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 1331 webkit_context_ = new WebKitContext( |
| 1332 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), |
| 1333 clear_local_state_on_exit_, quota_manager_->proxy(), |
| 1334 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); |
| 1330 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 1335 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
| 1331 BrowserThread::PostTask( | 1336 BrowserThread::PostTask( |
| 1332 BrowserThread::IO, FROM_HERE, | 1337 BrowserThread::IO, FROM_HERE, |
| 1333 NewRunnableMethod( | 1338 NewRunnableMethod( |
| 1334 appcache_service_.get(), | 1339 appcache_service_.get(), |
| 1335 &ChromeAppCacheService::InitializeOnIOThread, | 1340 &ChromeAppCacheService::InitializeOnIOThread, |
| 1336 IsOffTheRecord() | 1341 IsOffTheRecord() |
| 1337 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 1342 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
| 1338 &GetResourceContext(), | 1343 &GetResourceContext(), |
| 1339 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), | 1344 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), |
| 1340 clear_local_state_on_exit_)); | 1345 clear_local_state_on_exit_)); |
| 1341 } | 1346 } |
| 1342 | 1347 |
| 1343 WebKitContext* ProfileImpl::GetWebKitContext() { | 1348 WebKitContext* ProfileImpl::GetWebKitContext() { |
| 1344 if (!webkit_context_.get()) { | 1349 CreateQuotaManagerAndClients(); |
| 1345 webkit_context_ = new WebKitContext( | |
| 1346 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), | |
| 1347 clear_local_state_on_exit_); | |
| 1348 } | |
| 1349 return webkit_context_.get(); | 1350 return webkit_context_.get(); |
| 1350 } | 1351 } |
| 1351 | 1352 |
| 1352 void ProfileImpl::MarkAsCleanShutdown() { | 1353 void ProfileImpl::MarkAsCleanShutdown() { |
| 1353 if (prefs_.get()) { | 1354 if (prefs_.get()) { |
| 1354 // The session cleanly exited, set kSessionExitedCleanly appropriately. | 1355 // The session cleanly exited, set kSessionExitedCleanly appropriately. |
| 1355 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); | 1356 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); |
| 1356 | 1357 |
| 1357 // NOTE: If you change what thread this writes on, be sure and update | 1358 // NOTE: If you change what thread this writes on, be sure and update |
| 1358 // ChromeFrame::EndSession(). | 1359 // ChromeFrame::EndSession(). |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1651 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
| 1651 return NULL; | 1652 return NULL; |
| 1652 if (!prerender_manager_.get()) { | 1653 if (!prerender_manager_.get()) { |
| 1653 CHECK(g_browser_process->prerender_tracker()); | 1654 CHECK(g_browser_process->prerender_tracker()); |
| 1654 prerender_manager_.reset( | 1655 prerender_manager_.reset( |
| 1655 new prerender::PrerenderManager( | 1656 new prerender::PrerenderManager( |
| 1656 this, g_browser_process->prerender_tracker())); | 1657 this, g_browser_process->prerender_tracker())); |
| 1657 } | 1658 } |
| 1658 return prerender_manager_.get(); | 1659 return prerender_manager_.get(); |
| 1659 } | 1660 } |
| OLD | NEW |