Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: content/browser/in_process_webkit/dom_storage_context_impl.cc

Issue 9467016: Get rid of WebKitContext. Only two out of six HTML5 related objects were in it and it was just a gl… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix bug Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" 5 #include "content/browser/in_process_webkit/dom_storage_context_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "content/browser/in_process_webkit/dom_storage_area.h" 13 #include "content/browser/in_process_webkit/dom_storage_area.h"
14 #include "content/browser/in_process_webkit/dom_storage_namespace.h" 14 #include "content/browser/in_process_webkit/dom_storage_namespace.h"
15 #include "content/browser/in_process_webkit/webkit_context.h"
16 #include "content/common/dom_storage_common.h" 15 #include "content/common/dom_storage_common.h"
17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
21 #include "webkit/glue/webkit_glue.h" 19 #include "webkit/glue/webkit_glue.h"
22 #include "webkit/quota/special_storage_policy.h" 20 #include "webkit/quota/special_storage_policy.h"
23 21
24 using content::BrowserContext;
25 using content::BrowserThread; 22 using content::BrowserThread;
26 using content::DOMStorageContext; 23 using content::DOMStorageContext;
27 using WebKit::WebSecurityOrigin; 24 using WebKit::WebSecurityOrigin;
28 25
29 const FilePath::CharType DOMStorageContextImpl::kLocalStorageDirectory[] = 26 const FilePath::CharType DOMStorageContextImpl::kLocalStorageDirectory[] =
30 FILE_PATH_LITERAL("Local Storage"); 27 FILE_PATH_LITERAL("Local Storage");
31 28
32 const FilePath::CharType DOMStorageContextImpl::kLocalStorageExtension[] = 29 const FilePath::CharType DOMStorageContextImpl::kLocalStorageExtension[] =
33 FILE_PATH_LITERAL(".localstorage"); 30 FILE_PATH_LITERAL(".localstorage");
34 31
(...skipping 17 matching lines...) Expand all
52 !special_storage_policy->IsStorageSessionOnly(origin)) { 49 !special_storage_policy->IsStorageSessionOnly(origin)) {
53 continue; 50 continue;
54 } 51 }
55 file_util::Delete(file_path, false); 52 file_util::Delete(file_path, false);
56 } 53 }
57 } 54 }
58 } 55 }
59 56
60 } // namespace 57 } // namespace
61 58
62 DOMStorageContext* DOMStorageContext::GetForBrowserContext(
63 BrowserContext* context) {
64 return BrowserContext::GetWebKitContext(context)->dom_storage_context();
65 }
66
67 DOMStorageContextImpl::DOMStorageContextImpl( 59 DOMStorageContextImpl::DOMStorageContextImpl(
68 WebKitContext* webkit_context, 60 const FilePath& data_path,
69 quota::SpecialStoragePolicy* special_storage_policy) 61 quota::SpecialStoragePolicy* special_storage_policy)
70 : last_storage_area_id_(0), 62 : last_storage_area_id_(0),
71 last_session_storage_namespace_id_on_ui_thread_(kLocalStorageNamespaceId), 63 last_session_storage_namespace_id_on_ui_thread_(kLocalStorageNamespaceId),
72 last_session_storage_namespace_id_on_io_thread_(kLocalStorageNamespaceId), 64 last_session_storage_namespace_id_on_io_thread_(kLocalStorageNamespaceId),
73 clear_local_state_on_exit_(false), 65 clear_local_state_on_exit_(false),
74 save_session_state_(false), 66 save_session_state_(false),
75 special_storage_policy_(special_storage_policy) { 67 special_storage_policy_(special_storage_policy) {
76 data_path_ = webkit_context->data_path(); 68 data_path_ = data_path;
77 } 69 }
78 70
79 DOMStorageContextImpl::~DOMStorageContextImpl() { 71 DOMStorageContextImpl::~DOMStorageContextImpl() {
80 // This should not go away until all DOM Storage message filters have gone 72 // This should not go away until all DOM Storage message filters have gone
81 // away. And they remove themselves from this list. 73 // away. And they remove themselves from this list.
82 DCHECK(message_filter_set_.empty()); 74 DCHECK(message_filter_set_.empty());
83 75
84 for (StorageNamespaceMap::iterator iter(storage_namespace_map_.begin()); 76 for (StorageNamespaceMap::iterator iter(storage_namespace_map_.begin());
85 iter != storage_namespace_map_.end(); ++iter) { 77 iter != storage_namespace_map_.end(); ++iter) {
86 delete iter->second; 78 delete iter->second;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 files.push_back(file_path); 303 files.push_back(file_path);
312 } 304 }
313 return files; 305 return files;
314 } 306 }
315 307
316 FilePath DOMStorageContextImpl::GetFilePath(const string16& origin_id) const { 308 FilePath DOMStorageContextImpl::GetFilePath(const string16& origin_id) const {
317 FilePath storage_dir = data_path_.Append(kLocalStorageDirectory); 309 FilePath storage_dir = data_path_.Append(kLocalStorageDirectory);
318 FilePath::StringType id = webkit_glue::WebStringToFilePathString(origin_id); 310 FilePath::StringType id = webkit_glue::WebStringToFilePathString(origin_id);
319 return storage_dir.Append(id.append(kLocalStorageExtension)); 311 return storage_dir.Append(id.append(kLocalStorageExtension));
320 } 312 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698