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_ && prefs_->GetBoolean(prefs::kClearSiteDataOnExit)) | |
594 appcache_service_->SyncClearAppCacheOnIOThread(); | |
michaeln
2011/07/14 00:42:34
Just post a task to set the service's clear_on_exi
marja(google)
2011/07/14 10:31:59
Done.
| |
595 | |
593 StopCreateSessionServiceTimer(); | 596 StopCreateSessionServiceTimer(); |
594 | 597 |
595 // Remove pref observers | 598 // Remove pref observers |
596 pref_change_registrar_.RemoveAll(); | 599 pref_change_registrar_.RemoveAll(); |
597 | 600 |
598 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 601 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
599 | 602 |
600 if (clear_local_state_on_exit_) { | 603 if (clear_local_state_on_exit_) { |
601 BrowserThread::PostTask( | 604 BrowserThread::PostTask( |
602 BrowserThread::FILE, FROM_HERE, | 605 BrowserThread::FILE, FROM_HERE, |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1330 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); | 1333 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); |
1331 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 1334 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
1332 BrowserThread::PostTask( | 1335 BrowserThread::PostTask( |
1333 BrowserThread::IO, FROM_HERE, | 1336 BrowserThread::IO, FROM_HERE, |
1334 NewRunnableMethod( | 1337 NewRunnableMethod( |
1335 appcache_service_.get(), | 1338 appcache_service_.get(), |
1336 &ChromeAppCacheService::InitializeOnIOThread, | 1339 &ChromeAppCacheService::InitializeOnIOThread, |
1337 IsOffTheRecord() | 1340 IsOffTheRecord() |
1338 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 1341 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
1339 &GetResourceContext(), | 1342 &GetResourceContext(), |
1340 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), | 1343 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); |
1341 clear_local_state_on_exit_)); | |
1342 } | 1344 } |
1343 | 1345 |
1344 WebKitContext* ProfileImpl::GetWebKitContext() { | 1346 WebKitContext* ProfileImpl::GetWebKitContext() { |
1345 CreateQuotaManagerAndClients(); | 1347 CreateQuotaManagerAndClients(); |
1346 return webkit_context_.get(); | 1348 return webkit_context_.get(); |
1347 } | 1349 } |
1348 | 1350 |
1349 void ProfileImpl::MarkAsCleanShutdown() { | 1351 void ProfileImpl::MarkAsCleanShutdown() { |
1350 if (prefs_.get()) { | 1352 if (prefs_.get()) { |
1351 // The session cleanly exited, set kSessionExitedCleanly appropriately. | 1353 // 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(); | 1388 RenderProcessHost* process = i.GetCurrentValue(); |
1387 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); | 1389 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
1388 } | 1390 } |
1389 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1391 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
1390 clear_local_state_on_exit_ = | 1392 clear_local_state_on_exit_ = |
1391 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1393 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
1392 if (webkit_context_) { | 1394 if (webkit_context_) { |
1393 webkit_context_->set_clear_local_state_on_exit( | 1395 webkit_context_->set_clear_local_state_on_exit( |
1394 clear_local_state_on_exit_); | 1396 clear_local_state_on_exit_); |
1395 } | 1397 } |
1396 if (appcache_service_) { | |
1397 appcache_service_->SetClearLocalStateOnExit( | |
1398 clear_local_state_on_exit_); | |
1399 } | |
1400 if (db_tracker_) { | 1398 if (db_tracker_) { |
1401 db_tracker_->SetClearLocalStateOnExit( | 1399 db_tracker_->SetClearLocalStateOnExit( |
1402 clear_local_state_on_exit_); | 1400 clear_local_state_on_exit_); |
1403 } | 1401 } |
1404 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { | 1402 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { |
1405 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1403 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1406 profile_manager->RegisterProfileName(this); | 1404 profile_manager->RegisterProfileName(this); |
1407 } else if (*pref_name_in == prefs::kDefaultZoomLevel) { | 1405 } else if (*pref_name_in == prefs::kDefaultZoomLevel) { |
1408 GetHostZoomMap()->set_default_zoom_level( | 1406 GetHostZoomMap()->set_default_zoom_level( |
1409 prefs->GetDouble(prefs::kDefaultZoomLevel)); | 1407 prefs->GetDouble(prefs::kDefaultZoomLevel)); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1652 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1650 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
1653 return NULL; | 1651 return NULL; |
1654 if (!prerender_manager_.get()) { | 1652 if (!prerender_manager_.get()) { |
1655 CHECK(g_browser_process->prerender_tracker()); | 1653 CHECK(g_browser_process->prerender_tracker()); |
1656 prerender_manager_.reset( | 1654 prerender_manager_.reset( |
1657 new prerender::PrerenderManager( | 1655 new prerender::PrerenderManager( |
1658 this, g_browser_process->prerender_tracker())); | 1656 this, g_browser_process->prerender_tracker())); |
1659 } | 1657 } |
1660 return prerender_manager_.get(); | 1658 return prerender_manager_.get(); |
1661 } | 1659 } |
OLD | NEW |