| Index: chrome/browser/in_process_webkit/indexed_db_context.cc
|
| diff --git a/chrome/browser/in_process_webkit/indexed_db_context.cc b/chrome/browser/in_process_webkit/indexed_db_context.cc
|
| index 7f492ac563930143b584c4bc3142696a0ff5bfd9..99e25e6e44ad87a0055469c93f8bb023a722e494 100644
|
| --- a/chrome/browser/in_process_webkit/indexed_db_context.cc
|
| +++ b/chrome/browser/in_process_webkit/indexed_db_context.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/browser_thread.h"
|
| #include "chrome/browser/in_process_webkit/webkit_context.h"
|
| +#include "chrome/common/url_constants.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabase.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebIDBFactory.h"
|
| @@ -27,11 +28,18 @@ const FilePath::CharType IndexedDBContext::kIndexedDBDirectory[] =
|
| const FilePath::CharType IndexedDBContext::kIndexedDBExtension[] =
|
| FILE_PATH_LITERAL(".indexeddb");
|
|
|
| -IndexedDBContext::IndexedDBContext(WebKitContext* webkit_context)
|
| - : webkit_context_(webkit_context) {
|
| +IndexedDBContext::IndexedDBContext(WebKitContext* webkit_context) {
|
| + data_path_ = webkit_context->data_path().Append(kIndexedDBDirectory);
|
| }
|
|
|
| IndexedDBContext::~IndexedDBContext() {
|
| + if (clear_local_state_on_exit_) {
|
| + const char* url_scheme_skipped = chrome::kExtensionScheme;
|
| + BrowserThread::PostTask(
|
| + BrowserThread::WEBKIT, FROM_HERE,
|
| + NewRunnableFunction(&IndexedDBContext::ClearLocalState,
|
| + data_path_, url_scheme_skipped));
|
| + }
|
| }
|
|
|
| WebIDBFactory* IndexedDBContext::GetIDBFactory() {
|
| @@ -43,17 +51,15 @@ WebIDBFactory* IndexedDBContext::GetIDBFactory() {
|
|
|
| FilePath IndexedDBContext::GetIndexedDBFilePath(
|
| const string16& origin_id) const {
|
| - FilePath storage_dir = webkit_context_->data_path().Append(
|
| - kIndexedDBDirectory);
|
| FilePath::StringType id = webkit_glue::WebStringToFilePathString(origin_id);
|
| - return storage_dir.Append(id.append(kIndexedDBExtension));
|
| + return data_path_;
|
| }
|
|
|
| // static
|
| -void IndexedDBContext::ClearLocalState(const FilePath& profile_path,
|
| +void IndexedDBContext::ClearLocalState(const FilePath& indexeddb_path,
|
| const char* url_scheme_to_be_skipped) {
|
| - file_util::FileEnumerator file_enumerator(profile_path.Append(
|
| - kIndexedDBDirectory), false, file_util::FileEnumerator::FILES);
|
| + file_util::FileEnumerator file_enumerator(
|
| + indexeddb_path, false, file_util::FileEnumerator::FILES);
|
| // TODO(pastarmovj): We might need to consider exchanging this loop for
|
| // something more efficient in the future.
|
| for (FilePath file_path = file_enumerator.Next(); !file_path.empty();
|
|
|