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