| 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 "content/browser/quota/mock_quota_manager.h" | 5 #include "content/browser/quota/mock_quota_manager.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (current->type == type && current->modified >= modified_since) | 93 if (current->type == type && current->modified >= modified_since) |
| 94 origins_to_return->insert(current->origin); | 94 origins_to_return->insert(current->origin); |
| 95 } | 95 } |
| 96 | 96 |
| 97 base::ThreadTaskRunnerHandle::Get()->PostTask( | 97 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 98 FROM_HERE, base::Bind(&MockQuotaManager::DidGetModifiedSince, | 98 FROM_HERE, base::Bind(&MockQuotaManager::DidGetModifiedSince, |
| 99 weak_factory_.GetWeakPtr(), callback, | 99 weak_factory_.GetWeakPtr(), callback, |
| 100 base::Owned(origins_to_return), type)); | 100 base::Owned(origins_to_return), type)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void MockQuotaManager::DeleteOriginData( | 103 void MockQuotaManager::DeleteOriginData(const GURL& origin, |
| 104 const GURL& origin, | 104 StorageType type, |
| 105 StorageType type, | 105 int quota_client_mask, |
| 106 int quota_client_mask, | 106 bool is_eviction, |
| 107 const StatusCallback& callback) { | 107 const StatusCallback& callback) { |
| 108 for (std::vector<OriginInfo>::iterator current = origins_.begin(); | 108 for (std::vector<OriginInfo>::iterator current = origins_.begin(); |
| 109 current != origins_.end(); | 109 current != origins_.end(); |
| 110 ++current) { | 110 ++current) { |
| 111 if (current->origin == origin && current->type == type) { | 111 if (current->origin == origin && current->type == type) { |
| 112 // Modify the mask: if it's 0 after "deletion", remove the origin. | 112 // Modify the mask: if it's 0 after "deletion", remove the origin. |
| 113 current->quota_client_mask &= ~quota_client_mask; | 113 current->quota_client_mask &= ~quota_client_mask; |
| 114 if (current->quota_client_mask == 0) | 114 if (current->quota_client_mask == 0) |
| 115 origins_.erase(current); | 115 origins_.erase(current); |
| 116 break; | 116 break; |
| 117 } | 117 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 137 callback.Run(*origins, storage_type); | 137 callback.Run(*origins, storage_type); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void MockQuotaManager::DidDeleteOriginData( | 140 void MockQuotaManager::DidDeleteOriginData( |
| 141 const StatusCallback& callback, | 141 const StatusCallback& callback, |
| 142 QuotaStatusCode status) { | 142 QuotaStatusCode status) { |
| 143 callback.Run(status); | 143 callback.Run(status); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace content | 146 } // namespace content |
| OLD | NEW |