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..97abd83c3e034b614af3117773a202576a944f35 100644 | 
| --- a/chrome/browser/in_process_webkit/webkit_context.cc | 
| +++ b/chrome/browser/in_process_webkit/webkit_context.cc | 
| @@ -7,15 +7,24 @@ | 
| #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_type.h" | 
| +#include "chrome/common/pref_names.h" | 
| WebKitContext::WebKitContext(Profile* profile) | 
| : data_path_(profile->IsOffTheRecord() ? FilePath() : profile->GetPath()), | 
| is_incognito_(profile->IsOffTheRecord()), | 
| + profile_(profile), | 
| ALLOW_THIS_IN_INITIALIZER_LIST( | 
| dom_storage_context_(new DOMStorageContext(this))), | 
| ALLOW_THIS_IN_INITIALIZER_LIST( | 
| indexed_db_context_(new IndexedDBContext(this))) { | 
| + PrefService* prefs = profile->GetPrefs(); | 
| + 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,7 @@ WebKitContext::~WebKitContext() { | 
| delete dom_storage_context; | 
| } | 
| + indexed_db_context_->SetClearLocalStateOnExit(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 +88,16 @@ 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(); | 
| + if (prefs::kClearSiteDataOnExit == *name) | 
| + { | 
| + clear_local_state_on_exit_ = profile_->GetPrefs()->GetBoolean( | 
| 
 
jochen (gone - plz use gerrit)
2010/11/29 10:45:24
the notification source is the pref service, so yo
 
pastarmovj
2010/11/29 12:50:37
Done.
 
 | 
| + prefs::kClearSiteDataOnExit); | 
| + } | 
| + } | 
| +} |