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

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

Issue 6077005: Refactored app cache clear on exit code to happen in the object owning the files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed multithreading and added unit tests. Created 9 years, 11 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 572 }
573 573
574 ChromeAppCacheService* ProfileImpl::GetAppCacheService() { 574 ChromeAppCacheService* ProfileImpl::GetAppCacheService() {
575 if (!appcache_service_) { 575 if (!appcache_service_) {
576 appcache_service_ = new ChromeAppCacheService; 576 appcache_service_ = new ChromeAppCacheService;
577 BrowserThread::PostTask( 577 BrowserThread::PostTask(
578 BrowserThread::IO, FROM_HERE, 578 BrowserThread::IO, FROM_HERE,
579 NewRunnableMethod(appcache_service_.get(), 579 NewRunnableMethod(appcache_service_.get(),
580 &ChromeAppCacheService::InitializeOnIOThread, 580 &ChromeAppCacheService::InitializeOnIOThread,
581 GetPath(), IsOffTheRecord(), 581 GetPath(), IsOffTheRecord(),
582 make_scoped_refptr(GetHostContentSettingsMap()))); 582 make_scoped_refptr(GetHostContentSettingsMap()),
583 clear_local_state_on_exit_));
583 } 584 }
584 return appcache_service_; 585 return appcache_service_;
585 } 586 }
586 587
587 webkit_database::DatabaseTracker* ProfileImpl::GetDatabaseTracker() { 588 webkit_database::DatabaseTracker* ProfileImpl::GetDatabaseTracker() {
588 if (!db_tracker_) { 589 if (!db_tracker_) {
589 db_tracker_ = new webkit_database::DatabaseTracker( 590 db_tracker_ = new webkit_database::DatabaseTracker(
590 GetPath(), IsOffTheRecord()); 591 GetPath(), IsOffTheRecord());
591 } 592 }
592 return db_tracker_; 593 return db_tracker_;
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { 1216 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) {
1216 NotificationService::current()->Notify( 1217 NotificationService::current()->Notify(
1217 NotificationType::SPELLCHECK_AUTOSPELL_TOGGLED, 1218 NotificationType::SPELLCHECK_AUTOSPELL_TOGGLED,
1218 Source<Profile>(this), NotificationService::NoDetails()); 1219 Source<Profile>(this), NotificationService::NoDetails());
1219 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { 1220 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) {
1220 clear_local_state_on_exit_ = 1221 clear_local_state_on_exit_ =
1221 prefs->GetBoolean(prefs::kClearSiteDataOnExit); 1222 prefs->GetBoolean(prefs::kClearSiteDataOnExit);
1222 if (webkit_context_) 1223 if (webkit_context_)
1223 webkit_context_->set_clear_local_state_on_exit( 1224 webkit_context_->set_clear_local_state_on_exit(
1224 clear_local_state_on_exit_); 1225 clear_local_state_on_exit_);
1226 if (appcache_service_)
1227 appcache_service_->SetClearLocalStateOnExit(
1228 clear_local_state_on_exit_);
1225 } 1229 }
1226 } else if (NotificationType::THEME_INSTALLED == type) { 1230 } else if (NotificationType::THEME_INSTALLED == type) {
1227 DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile()); 1231 DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile());
1228 const Extension* extension = Details<const Extension>(details).ptr(); 1232 const Extension* extension = Details<const Extension>(details).ptr();
1229 SetTheme(extension); 1233 SetTheme(extension);
1230 } else if (NotificationType::BOOKMARK_MODEL_LOADED == type) { 1234 } else if (NotificationType::BOOKMARK_MODEL_LOADED == type) {
1231 GetProfileSyncService(); // Causes lazy-load if sync is enabled. 1235 GetProfileSyncService(); // Causes lazy-load if sync is enabled.
1232 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED, 1236 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED,
1233 Source<Profile>(this)); 1237 Source<Profile>(this));
1234 } 1238 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 } 1367 }
1364 1368
1365 PrerenderManager* ProfileImpl::GetPrerenderManager() { 1369 PrerenderManager* ProfileImpl::GetPrerenderManager() {
1366 CommandLine* cl = CommandLine::ForCurrentProcess(); 1370 CommandLine* cl = CommandLine::ForCurrentProcess();
1367 if (!cl->HasSwitch(switches::kEnablePagePrerender)) 1371 if (!cl->HasSwitch(switches::kEnablePagePrerender))
1368 return NULL; 1372 return NULL;
1369 if (!prerender_manager_.get()) 1373 if (!prerender_manager_.get())
1370 prerender_manager_.reset(new PrerenderManager(this)); 1374 prerender_manager_.reset(new PrerenderManager(this));
1371 return prerender_manager_.get(); 1375 return prerender_manager_.get();
1372 } 1376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698