| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_service_worker_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_service_worker_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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 CannedBrowsingDataServiceWorkerHelper::CannedBrowsingDataServiceWorkerHelper( | 116 CannedBrowsingDataServiceWorkerHelper::CannedBrowsingDataServiceWorkerHelper( |
| 117 content::ServiceWorkerContext* context) | 117 content::ServiceWorkerContext* context) |
| 118 : BrowsingDataServiceWorkerHelper(context) { | 118 : BrowsingDataServiceWorkerHelper(context) { |
| 119 } | 119 } |
| 120 | 120 |
| 121 CannedBrowsingDataServiceWorkerHelper:: | 121 CannedBrowsingDataServiceWorkerHelper:: |
| 122 ~CannedBrowsingDataServiceWorkerHelper() { | 122 ~CannedBrowsingDataServiceWorkerHelper() { |
| 123 } | 123 } |
| 124 | 124 |
| 125 CannedBrowsingDataServiceWorkerHelper* | |
| 126 CannedBrowsingDataServiceWorkerHelper::Clone() { | |
| 127 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 128 CannedBrowsingDataServiceWorkerHelper* clone = | |
| 129 new CannedBrowsingDataServiceWorkerHelper(service_worker_context_); | |
| 130 | |
| 131 clone->pending_service_worker_info_ = pending_service_worker_info_; | |
| 132 clone->service_worker_info_ = service_worker_info_; | |
| 133 return clone; | |
| 134 } | |
| 135 | |
| 136 void CannedBrowsingDataServiceWorkerHelper::AddServiceWorker( | 125 void CannedBrowsingDataServiceWorkerHelper::AddServiceWorker( |
| 137 const GURL& origin, const std::vector<GURL>& scopes) { | 126 const GURL& origin, const std::vector<GURL>& scopes) { |
| 138 if (!BrowsingDataHelper::HasWebScheme(origin)) | 127 if (!BrowsingDataHelper::HasWebScheme(origin)) |
| 139 return; // Non-websafe state is not considered browsing data. | 128 return; // Non-websafe state is not considered browsing data. |
| 140 | 129 |
| 141 pending_service_worker_info_.insert( | 130 pending_service_worker_info_.insert( |
| 142 PendingServiceWorkerUsageInfo(origin, scopes)); | 131 PendingServiceWorkerUsageInfo(origin, scopes)); |
| 143 } | 132 } |
| 144 | 133 |
| 145 void CannedBrowsingDataServiceWorkerHelper::Reset() { | 134 void CannedBrowsingDataServiceWorkerHelper::Reset() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 for (std::set<PendingServiceWorkerUsageInfo>::iterator it = | 174 for (std::set<PendingServiceWorkerUsageInfo>::iterator it = |
| 186 pending_service_worker_info_.begin(); | 175 pending_service_worker_info_.begin(); |
| 187 it != pending_service_worker_info_.end();) { | 176 it != pending_service_worker_info_.end();) { |
| 188 if (it->origin == origin) | 177 if (it->origin == origin) |
| 189 pending_service_worker_info_.erase(it++); | 178 pending_service_worker_info_.erase(it++); |
| 190 else | 179 else |
| 191 ++it; | 180 ++it; |
| 192 } | 181 } |
| 193 BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(origin); | 182 BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(origin); |
| 194 } | 183 } |
| OLD | NEW |