| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 void ProfileImpl::set_last_selected_directory(const FilePath& path) { | 583 void ProfileImpl::set_last_selected_directory(const FilePath& path) { |
| 584 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 584 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
| 585 } | 585 } |
| 586 | 586 |
| 587 ProfileImpl::~ProfileImpl() { | 587 ProfileImpl::~ProfileImpl() { |
| 588 NotificationService::current()->Notify( | 588 NotificationService::current()->Notify( |
| 589 chrome::NOTIFICATION_PROFILE_DESTROYED, | 589 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 590 Source<Profile>(this), | 590 Source<Profile>(this), |
| 591 NotificationService::NoDetails()); | 591 NotificationService::NoDetails()); |
| 592 | 592 |
| 593 if (appcache_service_ && clear_local_state_on_exit_) { |
| 594 BrowserThread::PostTask( |
| 595 BrowserThread::IO, FROM_HERE, |
| 596 NewRunnableMethod( |
| 597 appcache_service_.get(), |
| 598 &appcache::AppCacheService::set_clear_local_state_on_exit, |
| 599 true)); |
| 600 } |
| 601 |
| 593 StopCreateSessionServiceTimer(); | 602 StopCreateSessionServiceTimer(); |
| 594 | 603 |
| 595 // Remove pref observers | 604 // Remove pref observers |
| 596 pref_change_registrar_.RemoveAll(); | 605 pref_change_registrar_.RemoveAll(); |
| 597 | 606 |
| 598 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 607 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 599 | 608 |
| 600 if (clear_local_state_on_exit_) { | 609 if (clear_local_state_on_exit_) { |
| 601 BrowserThread::PostTask( | 610 BrowserThread::PostTask( |
| 602 BrowserThread::FILE, FROM_HERE, | 611 BrowserThread::FILE, FROM_HERE, |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); | 1339 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); |
| 1331 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 1340 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
| 1332 BrowserThread::PostTask( | 1341 BrowserThread::PostTask( |
| 1333 BrowserThread::IO, FROM_HERE, | 1342 BrowserThread::IO, FROM_HERE, |
| 1334 NewRunnableMethod( | 1343 NewRunnableMethod( |
| 1335 appcache_service_.get(), | 1344 appcache_service_.get(), |
| 1336 &ChromeAppCacheService::InitializeOnIOThread, | 1345 &ChromeAppCacheService::InitializeOnIOThread, |
| 1337 IsOffTheRecord() | 1346 IsOffTheRecord() |
| 1338 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 1347 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
| 1339 &GetResourceContext(), | 1348 &GetResourceContext(), |
| 1340 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), | 1349 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); |
| 1341 clear_local_state_on_exit_)); | |
| 1342 } | 1350 } |
| 1343 | 1351 |
| 1344 WebKitContext* ProfileImpl::GetWebKitContext() { | 1352 WebKitContext* ProfileImpl::GetWebKitContext() { |
| 1345 CreateQuotaManagerAndClients(); | 1353 CreateQuotaManagerAndClients(); |
| 1346 return webkit_context_.get(); | 1354 return webkit_context_.get(); |
| 1347 } | 1355 } |
| 1348 | 1356 |
| 1349 void ProfileImpl::MarkAsCleanShutdown() { | 1357 void ProfileImpl::MarkAsCleanShutdown() { |
| 1350 if (prefs_.get()) { | 1358 if (prefs_.get()) { |
| 1351 // The session cleanly exited, set kSessionExitedCleanly appropriately. | 1359 // The session cleanly exited, set kSessionExitedCleanly appropriately. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 RenderProcessHost* process = i.GetCurrentValue(); | 1394 RenderProcessHost* process = i.GetCurrentValue(); |
| 1387 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); | 1395 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
| 1388 } | 1396 } |
| 1389 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1397 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
| 1390 clear_local_state_on_exit_ = | 1398 clear_local_state_on_exit_ = |
| 1391 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1399 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| 1392 if (webkit_context_) { | 1400 if (webkit_context_) { |
| 1393 webkit_context_->set_clear_local_state_on_exit( | 1401 webkit_context_->set_clear_local_state_on_exit( |
| 1394 clear_local_state_on_exit_); | 1402 clear_local_state_on_exit_); |
| 1395 } | 1403 } |
| 1396 if (appcache_service_) { | |
| 1397 appcache_service_->SetClearLocalStateOnExit( | |
| 1398 clear_local_state_on_exit_); | |
| 1399 } | |
| 1400 if (db_tracker_) { | 1404 if (db_tracker_) { |
| 1401 db_tracker_->SetClearLocalStateOnExit( | 1405 db_tracker_->SetClearLocalStateOnExit( |
| 1402 clear_local_state_on_exit_); | 1406 clear_local_state_on_exit_); |
| 1403 } | 1407 } |
| 1404 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { | 1408 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { |
| 1405 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1409 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 1406 profile_manager->RegisterProfileName(this); | 1410 profile_manager->RegisterProfileName(this); |
| 1407 } else if (*pref_name_in == prefs::kDefaultZoomLevel) { | 1411 } else if (*pref_name_in == prefs::kDefaultZoomLevel) { |
| 1408 GetHostZoomMap()->set_default_zoom_level( | 1412 GetHostZoomMap()->set_default_zoom_level( |
| 1409 prefs->GetDouble(prefs::kDefaultZoomLevel)); | 1413 prefs->GetDouble(prefs::kDefaultZoomLevel)); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1656 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
| 1653 return NULL; | 1657 return NULL; |
| 1654 if (!prerender_manager_.get()) { | 1658 if (!prerender_manager_.get()) { |
| 1655 CHECK(g_browser_process->prerender_tracker()); | 1659 CHECK(g_browser_process->prerender_tracker()); |
| 1656 prerender_manager_.reset( | 1660 prerender_manager_.reset( |
| 1657 new prerender::PrerenderManager( | 1661 new prerender::PrerenderManager( |
| 1658 this, g_browser_process->prerender_tracker())); | 1662 this, g_browser_process->prerender_tracker())); |
| 1659 } | 1663 } |
| 1660 return prerender_manager_.get(); | 1664 return prerender_manager_.get(); |
| 1661 } | 1665 } |
| OLD | NEW |