diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 21:15:18 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 21:15:18 +0000 |
commit | 03c9d749e8b8785d245b27402bdd9a785033810e (patch) | |
tree | 513131976875f5c4c3f08003cabb0ff4555c756b /chrome | |
parent | 0d7cef4d19826157be5d8ee93a5a85a8a3d2fe5c (diff) | |
download | chromium_src-03c9d749e8b8785d245b27402bdd9a785033810e.zip chromium_src-03c9d749e8b8785d245b27402bdd9a785033810e.tar.gz chromium_src-03c9d749e8b8785d245b27402bdd9a785033810e.tar.bz2 |
When clearing browsing data modified since a certain time, do not delete extension data.
You can use the cookie tree model to really delete all data.
BUG=34598
TEST=install an extension that uses local storage, delete browsing data, check that the extension data still exist.
Review URL: http://codereview.chromium.org/573030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
5 files changed, 30 insertions, 15 deletions
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc index 11581b9..37b4cd4 100644 --- a/chrome/browser/browsing_data_remover.cc +++ b/chrome/browser/browsing_data_remover.cc @@ -17,6 +17,7 @@ #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/notification_service.h" +#include "chrome/common/url_constants.h" #include "net/base/cookie_monster.h" #include "net/disk_cache/disk_cache.h" #include "net/http/http_cache.h" @@ -112,7 +113,8 @@ void BrowsingDataRemover::Remove(int remove_mask) { profile_->GetRequestContext()->GetCookieStore()->GetCookieMonster(); if (cookie_monster) cookie_monster->DeleteAllCreatedBetween(delete_begin_, delete_end_, true); - profile_->GetWebKitContext()->DeleteDataModifiedSince(delete_begin_); + profile_->GetWebKitContext()->DeleteDataModifiedSince( + delete_begin_, chrome::kExtensionScheme); } if (remove_mask & REMOVE_PASSWORDS) { diff --git a/chrome/browser/in_process_webkit/dom_storage_context.cc b/chrome/browser/in_process_webkit/dom_storage_context.cc index 4156576..d6e544d 100644 --- a/chrome/browser/in_process_webkit/dom_storage_context.cc +++ b/chrome/browser/in_process_webkit/dom_storage_context.cc @@ -155,7 +155,9 @@ void DOMStorageContext::PurgeMemory() { local_storage->PurgeMemory(); } -void DOMStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) { +void DOMStorageContext::DeleteDataModifiedSince( + const base::Time& cutoff, + const char* url_scheme_to_be_skipped) { // Make sure that we don't delete a database that's currently being accessed // by unloading all of the databases temporarily. PurgeMemory(); @@ -165,6 +167,11 @@ void DOMStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) { file_util::FileEnumerator::FILES); for (FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { + scoped_ptr<WebKit::WebSecurityOrigin> web_security_origin( + WebKit::WebSecurityOrigin::createFromDatabaseIdentifier( + webkit_glue::FilePathToWebString(path.BaseName()))); + if (EqualsASCII(web_security_origin->protocol(), url_scheme_to_be_skipped)) + continue; file_util::FileEnumerator::FindInfo find_info; file_enumerator.GetFindInfo(&find_info); if (file_util::HasFileBeenModifiedSince(find_info, cutoff)) @@ -243,7 +250,7 @@ void DOMStorageContext::CompleteCloningSessionStorage( // static void DOMStorageContext::ClearLocalState(const FilePath& profile_path, - const char* url_scheme_to_be_skip) { + const char* url_scheme_to_be_skipped) { file_util::FileEnumerator file_enumerator(profile_path.Append( kLocalStorageDirectory), false, file_util::FileEnumerator::FILES); for (FilePath file_path = file_enumerator.Next(); !file_path.empty(); @@ -252,7 +259,8 @@ void DOMStorageContext::ClearLocalState(const FilePath& profile_path, scoped_ptr<WebKit::WebSecurityOrigin> web_security_origin( WebKit::WebSecurityOrigin::createFromDatabaseIdentifier( webkit_glue::FilePathToWebString(file_path.BaseName()))); - if (!EqualsASCII(web_security_origin->protocol(), url_scheme_to_be_skip)) + if (!EqualsASCII(web_security_origin->protocol(), + url_scheme_to_be_skipped)) file_util::Delete(file_path, false); } } diff --git a/chrome/browser/in_process_webkit/dom_storage_context.h b/chrome/browser/in_process_webkit/dom_storage_context.h index 49e3712..81276c2 100644 --- a/chrome/browser/in_process_webkit/dom_storage_context.h +++ b/chrome/browser/in_process_webkit/dom_storage_context.h @@ -64,7 +64,8 @@ class DOMStorageContext { // Delete any local storage files that have been touched since the cutoff // date that's supplied. - void DeleteDataModifiedSince(const base::Time& cutoff); + void DeleteDataModifiedSince(const base::Time& cutoff, + const char* url_scheme_to_be_skipped); // Deletes a single local storage file. void DeleteLocalStorageFile(const FilePath& file_path); diff --git a/chrome/browser/in_process_webkit/webkit_context.cc b/chrome/browser/in_process_webkit/webkit_context.cc index 783f7a6..be07568 100644 --- a/chrome/browser/in_process_webkit/webkit_context.cc +++ b/chrome/browser/in_process_webkit/webkit_context.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "chrome/browser/in_process_webkit/webkit_context.h" @@ -38,17 +38,20 @@ void WebKitContext::PurgeMemory() { dom_storage_context_->PurgeMemory(); } -void WebKitContext::DeleteDataModifiedSince(const base::Time& cutoff) { +void WebKitContext::DeleteDataModifiedSince( + const base::Time& cutoff, + const char* url_scheme_to_be_skipped) { if (!ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)) { bool result = ChromeThread::PostTask( ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod(this, &WebKitContext::DeleteDataModifiedSince, - cutoff)); + cutoff, url_scheme_to_be_skipped)); DCHECK(result); return; } - dom_storage_context_->DeleteDataModifiedSince(cutoff); + dom_storage_context_->DeleteDataModifiedSince(cutoff, + url_scheme_to_be_skipped); } diff --git a/chrome/browser/in_process_webkit/webkit_context.h b/chrome/browser/in_process_webkit/webkit_context.h index 229e47f..82fa12d 100644 --- a/chrome/browser/in_process_webkit/webkit_context.h +++ b/chrome/browser/in_process_webkit/webkit_context.h @@ -1,6 +1,6 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ #define CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_CONTEXT_H_ @@ -43,7 +43,8 @@ class WebKitContext : public base::RefCountedThreadSafe<WebKitContext> { // Tell all children (where applicable) to delete any objects that were // last modified on or after the following time. - void DeleteDataModifiedSince(const base::Time& cutoff); + void DeleteDataModifiedSince(const base::Time& cutoff, + const char* url_scheme_to_be_skipped); // Delete the session storage namespace associated with this id. Called from // the UI thread. |