Index: chrome/browser/profile_impl.cc |
diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc |
index cad400b6045ce09c74fd34f7293bea909ea5b98a..6e19ef48d2765446c168787a0361cb9108ab8f5b 100644 |
--- a/chrome/browser/profile_impl.cc |
+++ b/chrome/browser/profile_impl.cc |
@@ -273,6 +273,7 @@ ProfileImpl::ProfileImpl(const FilePath& path) |
pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); |
+ pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); |
// Convert active labs into switches. Modifies the current command line. |
about_flags::ConvertFlagsToSwitches(prefs, CommandLine::ForCurrentProcess()); |
@@ -318,6 +319,8 @@ ProfileImpl::ProfileImpl(const FilePath& path) |
GetPolicyContext()->Initialize(); |
+ clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
+ |
// Log the profile size after a reasonable startup delay. |
BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, |
new ProfileSizeTask(path_), 112000); |
@@ -1166,7 +1169,7 @@ void ProfileImpl::SpellCheckHostInitialized() { |
WebKitContext* ProfileImpl::GetWebKitContext() { |
if (!webkit_context_.get()) |
- webkit_context_ = new WebKitContext(this); |
+ webkit_context_ = new WebKitContext(this, clear_local_state_on_exit_); |
DCHECK(webkit_context_.get()); |
return webkit_context_.get(); |
} |
@@ -1205,6 +1208,12 @@ void ProfileImpl::Observe(NotificationType type, |
NotificationService::current()->Notify( |
NotificationType::SPELLCHECK_AUTOSPELL_TOGGLED, |
Source<Profile>(this), NotificationService::NoDetails()); |
+ } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
+ clear_local_state_on_exit_ = |
+ prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
+ if (webkit_context_) |
+ webkit_context_->set_clear_local_state_on_exit( |
+ clear_local_state_on_exit_); |
} |
} else if (NotificationType::THEME_INSTALLED == type) { |
DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile()); |