OLD | NEW |
---|---|
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/indexed_db_context.h" | 5 #include "content/browser/in_process_webkit/indexed_db_context.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "content/browser/browser_thread.h" | 12 #include "content/browser/browser_thread.h" |
13 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" | 13 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" |
14 #include "content/browser/in_process_webkit/webkit_context.h" | 14 #include "content/browser/in_process_webkit/webkit_context.h" |
15 #include "content/common/url_constants.h" | |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
21 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
22 #include "webkit/quota/quota_manager.h" | 23 #include "webkit/quota/quota_manager.h" |
23 #include "webkit/quota/special_storage_policy.h" | 24 #include "webkit/quota/special_storage_policy.h" |
24 | 25 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 FilePath idb_file = GetIndexedDBFilePath(origin_id); | 112 FilePath idb_file = GetIndexedDBFilePath(origin_id); |
112 DCHECK_EQ(idb_file.BaseName().value().substr(0, strlen("chrome-extension")), | 113 DCHECK_EQ(idb_file.BaseName().value().substr(0, strlen("chrome-extension")), |
113 FILE_PATH_LITERAL("chrome-extension")); | 114 FILE_PATH_LITERAL("chrome-extension")); |
114 DeleteIndexedDBFile(GetIndexedDBFilePath(origin_id)); | 115 DeleteIndexedDBFile(GetIndexedDBFilePath(origin_id)); |
115 } | 116 } |
116 | 117 |
117 bool IndexedDBContext::IsUnlimitedStorageGranted( | 118 bool IndexedDBContext::IsUnlimitedStorageGranted( |
118 const GURL& origin) const { | 119 const GURL& origin) const { |
119 return special_storage_policy_->IsStorageUnlimited(origin); | 120 return special_storage_policy_->IsStorageUnlimited(origin); |
120 } | 121 } |
122 | |
123 // TODO(dgrogan): Merge this code with the similar loop in | |
124 // BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread. | |
125 void IndexedDBContext::GetAllOriginIdentifiers( | |
126 std::vector<string16>* origin_ids) { | |
127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | |
128 file_util::FileEnumerator file_enumerator(data_path_, | |
129 false, file_util::FileEnumerator::DIRECTORIES); | |
130 for (FilePath file_path = file_enumerator.Next(); !file_path.empty(); | |
131 file_path = file_enumerator.Next()) { | |
132 if (file_path.Extension() == IndexedDBContext::kIndexedDBExtension) { | |
133 WebKit::WebString origin_id_webstring = | |
134 webkit_glue::FilePathToWebString(file_path.BaseName()); | |
135 string16 origin_id = origin_id_webstring; | |
136 WebSecurityOrigin web_security_origin = | |
137 WebSecurityOrigin::createFromDatabaseIdentifier(origin_id_webstring); | |
138 if (EqualsASCII(web_security_origin.protocol(), | |
139 chrome::kExtensionScheme)) { | |
michaeln
2011/07/07 21:33:56
I don't think extension origins should be filtered
dgrogan
2011/07/07 21:55:37
Done.
| |
140 // Extension state is not considered browsing data. | |
141 continue; | |
142 } | |
143 origin_ids->push_back(origin_id); | |
144 } | |
145 } | |
146 } | |
OLD | NEW |