| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/browsing_data_indexed_db_helper.h" | 5 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 &BrowsingDataIndexedDBHelperImpl::DeleteIndexedDBInWebKitThread, this, | 101 &BrowsingDataIndexedDBHelperImpl::DeleteIndexedDBInWebKitThread, this, |
| 102 origin)); | 102 origin)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread() { | 105 void BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread() { |
| 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 107 std::vector<GURL> origins = indexed_db_context_->GetAllOrigins(); | 107 std::vector<GURL> origins = indexed_db_context_->GetAllOrigins(); |
| 108 for (std::vector<GURL>::const_iterator iter = origins.begin(); | 108 for (std::vector<GURL>::const_iterator iter = origins.begin(); |
| 109 iter != origins.end(); ++iter) { | 109 iter != origins.end(); ++iter) { |
| 110 const GURL& origin = *iter; | 110 const GURL& origin = *iter; |
| 111 if (!BrowsingDataHelper::HasValidScheme(origin)) | 111 if (!BrowsingDataHelper::HasWebScheme(origin)) |
| 112 continue; // Non-websafe state is not considered browsing data. | 112 continue; // Non-websafe state is not considered browsing data. |
| 113 | 113 |
| 114 indexed_db_info_.push_back(IndexedDBInfo( | 114 indexed_db_info_.push_back(IndexedDBInfo( |
| 115 origin, | 115 origin, |
| 116 indexed_db_context_->GetOriginDiskUsage(origin), | 116 indexed_db_context_->GetOriginDiskUsage(origin), |
| 117 indexed_db_context_->GetOriginLastModified(origin))); | 117 indexed_db_context_->GetOriginLastModified(origin))); |
| 118 } | 118 } |
| 119 | 119 |
| 120 BrowserThread::PostTask( | 120 BrowserThread::PostTask( |
| 121 BrowserThread::UI, FROM_HERE, | 121 BrowserThread::UI, FROM_HERE, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 new CannedBrowsingDataIndexedDBHelper(); | 185 new CannedBrowsingDataIndexedDBHelper(); |
| 186 | 186 |
| 187 base::AutoLock auto_lock(lock_); | 187 base::AutoLock auto_lock(lock_); |
| 188 clone->pending_indexed_db_info_ = pending_indexed_db_info_; | 188 clone->pending_indexed_db_info_ = pending_indexed_db_info_; |
| 189 clone->indexed_db_info_ = indexed_db_info_; | 189 clone->indexed_db_info_ = indexed_db_info_; |
| 190 return clone; | 190 return clone; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void CannedBrowsingDataIndexedDBHelper::AddIndexedDB( | 193 void CannedBrowsingDataIndexedDBHelper::AddIndexedDB( |
| 194 const GURL& origin, const string16& name) { | 194 const GURL& origin, const string16& name) { |
| 195 if (!BrowsingDataHelper::HasValidScheme(origin)) | 195 if (!BrowsingDataHelper::HasWebScheme(origin)) |
| 196 return; // Non-websafe state is not considered browsing data. | 196 return; // Non-websafe state is not considered browsing data. |
| 197 | 197 |
| 198 base::AutoLock auto_lock(lock_); | 198 base::AutoLock auto_lock(lock_); |
| 199 pending_indexed_db_info_.insert(PendingIndexedDBInfo(origin, name)); | 199 pending_indexed_db_info_.insert(PendingIndexedDBInfo(origin, name)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void CannedBrowsingDataIndexedDBHelper::Reset() { | 202 void CannedBrowsingDataIndexedDBHelper::Reset() { |
| 203 base::AutoLock auto_lock(lock_); | 203 base::AutoLock auto_lock(lock_); |
| 204 indexed_db_info_.clear(); | 204 indexed_db_info_.clear(); |
| 205 pending_indexed_db_info_.clear(); | 205 pending_indexed_db_info_.clear(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 | 255 |
| 256 void CannedBrowsingDataIndexedDBHelper::NotifyInUIThread() { | 256 void CannedBrowsingDataIndexedDBHelper::NotifyInUIThread() { |
| 257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 258 DCHECK(is_fetching_); | 258 DCHECK(is_fetching_); |
| 259 | 259 |
| 260 completion_callback_.Run(indexed_db_info_); | 260 completion_callback_.Run(indexed_db_info_); |
| 261 completion_callback_.Reset(); | 261 completion_callback_.Reset(); |
| 262 is_fetching_ = false; | 262 is_fetching_ = false; |
| 263 } | 263 } |
| OLD | NEW |