| 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/browsing_data_local_storage_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> result; | 38 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> result; |
| 39 for (const content::LocalStorageUsageInfo& info : infos) { | 39 for (const content::LocalStorageUsageInfo& info : infos) { |
| 40 if (!HasStorageScheme(info.origin)) | 40 if (!HasStorageScheme(info.origin)) |
| 41 continue; | 41 continue; |
| 42 result.push_back(BrowsingDataLocalStorageHelper::LocalStorageInfo( | 42 result.push_back(BrowsingDataLocalStorageHelper::LocalStorageInfo( |
| 43 info.origin, info.data_size, info.last_modified)); | 43 info.origin, info.data_size, info.last_modified)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 46 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 47 base::Bind(callback, result)); | 47 base::BindOnce(callback, result)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 BrowsingDataLocalStorageHelper::LocalStorageInfo::LocalStorageInfo( | 52 BrowsingDataLocalStorageHelper::LocalStorageInfo::LocalStorageInfo( |
| 53 const GURL& origin_url, | 53 const GURL& origin_url, |
| 54 int64_t size, | 54 int64_t size, |
| 55 base::Time last_modified) | 55 base::Time last_modified) |
| 56 : origin_url(origin_url), size(size), last_modified(last_modified) {} | 56 : origin_url(origin_url), size(size), last_modified(last_modified) {} |
| 57 | 57 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 void CannedBrowsingDataLocalStorageHelper::StartFetching( | 119 void CannedBrowsingDataLocalStorageHelper::StartFetching( |
| 120 const FetchCallback& callback) { | 120 const FetchCallback& callback) { |
| 121 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 121 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 122 DCHECK(!callback.is_null()); | 122 DCHECK(!callback.is_null()); |
| 123 | 123 |
| 124 std::list<LocalStorageInfo> result; | 124 std::list<LocalStorageInfo> result; |
| 125 for (const GURL& url : pending_local_storage_info_) | 125 for (const GURL& url : pending_local_storage_info_) |
| 126 result.push_back(LocalStorageInfo(url, 0, base::Time())); | 126 result.push_back(LocalStorageInfo(url, 0, base::Time())); |
| 127 | 127 |
| 128 BrowserThread::PostTask( | 128 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 129 BrowserThread::UI, FROM_HERE, base::Bind(callback, result)); | 129 base::BindOnce(callback, result)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void CannedBrowsingDataLocalStorageHelper::DeleteOrigin( | 132 void CannedBrowsingDataLocalStorageHelper::DeleteOrigin( |
| 133 const GURL& origin_url) { | 133 const GURL& origin_url) { |
| 134 pending_local_storage_info_.erase(origin_url); | 134 pending_local_storage_info_.erase(origin_url); |
| 135 // All suborigins associated with |origin_url| must be removed. | 135 // All suborigins associated with |origin_url| must be removed. |
| 136 // BrowsingDataLocalStorageHelper::DeleteOrigin takes care of doing that on | 136 // BrowsingDataLocalStorageHelper::DeleteOrigin takes care of doing that on |
| 137 // the backend so it's not necessary to call it for each suborigin, but it is | 137 // the backend so it's not necessary to call it for each suborigin, but it is |
| 138 // necessary to clear up the pending storage here. | 138 // necessary to clear up the pending storage here. |
| 139 BrowsingDataLocalStorageHelper::DeleteOrigin(origin_url); | 139 BrowsingDataLocalStorageHelper::DeleteOrigin(origin_url); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 153 if (!origin.suborigin().empty()) { | 153 if (!origin.suborigin().empty()) { |
| 154 GURL physical_origin(origin.GetPhysicalOrigin().GetURL()); | 154 GURL physical_origin(origin.GetPhysicalOrigin().GetURL()); |
| 155 pending_local_storage_info_.erase(physical_origin); | 155 pending_local_storage_info_.erase(physical_origin); |
| 156 pending_origins_to_pending_suborigins_.erase(physical_origin); | 156 pending_origins_to_pending_suborigins_.erase(physical_origin); |
| 157 } | 157 } |
| 158 | 158 |
| 159 pending_origins_to_pending_suborigins_.erase(origin_url); | 159 pending_origins_to_pending_suborigins_.erase(origin_url); |
| 160 } | 160 } |
| 161 | 161 |
| 162 CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {} | 162 CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {} |
| OLD | NEW |