Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 7210006: AppCaches which belong to hosted apps are not protected from deletion (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Moving test helpers to webkit/appcache. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 void ProfileImpl::set_last_selected_directory(const FilePath& path) { 587 void ProfileImpl::set_last_selected_directory(const FilePath& path) {
588 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); 588 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path);
589 } 589 }
590 590
591 ProfileImpl::~ProfileImpl() { 591 ProfileImpl::~ProfileImpl() {
592 NotificationService::current()->Notify( 592 NotificationService::current()->Notify(
593 chrome::NOTIFICATION_PROFILE_DESTROYED, 593 chrome::NOTIFICATION_PROFILE_DESTROYED,
594 Source<Profile>(this), 594 Source<Profile>(this),
595 NotificationService::NoDetails()); 595 NotificationService::NoDetails());
596 596
597 if (appcache_service_ && clear_local_state_on_exit_) {
598 BrowserThread::PostTask(
599 BrowserThread::IO, FROM_HERE,
600 NewRunnableMethod(
601 appcache_service_.get(),
602 &appcache::AppCacheService::set_clear_local_state_on_exit,
603 true));
604 }
605
597 StopCreateSessionServiceTimer(); 606 StopCreateSessionServiceTimer();
598 607
599 // Remove pref observers 608 // Remove pref observers
600 pref_change_registrar_.RemoveAll(); 609 pref_change_registrar_.RemoveAll();
601 610
602 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); 611 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
603 612
604 if (clear_local_state_on_exit_) { 613 if (clear_local_state_on_exit_) {
605 BrowserThread::PostTask( 614 BrowserThread::PostTask(
606 BrowserThread::FILE, FROM_HERE, 615 BrowserThread::FILE, FROM_HERE,
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698