Chromium Code Reviews| Index: chrome/browser/in_process_webkit/webkit_context.cc |
| diff --git a/chrome/browser/in_process_webkit/webkit_context.cc b/chrome/browser/in_process_webkit/webkit_context.cc |
| index 32fccf7b7c702e60c9bcca9ba77a3a35b7be86e2..7c81129aed4962e30da94b02f7ad44fb404aa277 100644 |
| --- a/chrome/browser/in_process_webkit/webkit_context.cc |
| +++ b/chrome/browser/in_process_webkit/webkit_context.cc |
| @@ -7,7 +7,12 @@ |
| #include "base/command_line.h" |
| #include "chrome/browser/browser_thread.h" |
| #include "chrome/browser/profile.h" |
| +#include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/common/chrome_switches.h" |
| +#include "chrome/common/notification_details.h" |
| +#include "chrome/common/notification_source.h" |
| +#include "chrome/common/notification_type.h" |
| +#include "chrome/common/pref_names.h" |
| WebKitContext::WebKitContext(Profile* profile) |
| : data_path_(profile->IsOffTheRecord() ? FilePath() : profile->GetPath()), |
| @@ -16,6 +21,10 @@ WebKitContext::WebKitContext(Profile* profile) |
| dom_storage_context_(new DOMStorageContext(this))), |
| ALLOW_THIS_IN_INITIALIZER_LIST( |
| indexed_db_context_(new IndexedDBContext(this))) { |
| + PrefService* prefs = profile->GetPrefs(); |
|
jochen (gone - plz use gerrit)
2010/11/29 13:29:33
hum. if the profile is off the record, you should
pastarmovj
2010/11/29 13:45:12
Done.
|
| + clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| + pref_change_registrar_.Init(prefs); |
| + pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); |
| } |
| WebKitContext::~WebKitContext() { |
| @@ -30,6 +39,8 @@ WebKitContext::~WebKitContext() { |
| delete dom_storage_context; |
| } |
| + indexed_db_context_->set_clear_local_state_on_exit_( |
| + clear_local_state_on_exit_); |
| IndexedDBContext* indexed_db_context = indexed_db_context_.release(); |
| if (!BrowserThread::DeleteSoon( |
| BrowserThread::WEBKIT, FROM_HERE, indexed_db_context)) { |
| @@ -78,3 +89,17 @@ void WebKitContext::DeleteSessionStorageNamespace( |
| dom_storage_context_->DeleteSessionStorageNamespace( |
| session_storage_namespace_id); |
| } |
| + |
| +void WebKitContext::Observe(NotificationType type, |
| + const NotificationSource& source, |
| + const NotificationDetails& details) { |
| + if (NotificationType::PREF_CHANGED == type) { |
| + std::string* name = Details<std::string>(details).ptr(); |
| + PrefService* prefs = Source<PrefService>(source).ptr(); |
| + if (prefs::kClearSiteDataOnExit == *name) |
| + { |
|
jochen (gone - plz use gerrit)
2010/11/29 13:29:33
{ on previous line
pastarmovj
2010/11/29 13:45:12
Done.
|
| + clear_local_state_on_exit_ = prefs->GetBoolean( |
|
jochen (gone - plz use gerrit)
2010/11/29 13:29:33
i'd wrap around after the =
pastarmovj
2010/11/29 13:45:12
Done.
|
| + prefs::kClearSiteDataOnExit); |
| + } |
| + } |
| +} |