OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webkit/browser/quota/mock_storage_client.h" | 5 #include "webkit/browser/quota/mock_storage_client.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 void MockStorageClient::DeleteOriginData( | 115 void MockStorageClient::DeleteOriginData( |
116 const GURL& origin, StorageType type, | 116 const GURL& origin, StorageType type, |
117 const DeletionCallback& callback) { | 117 const DeletionCallback& callback) { |
118 base::MessageLoopProxy::current()->PostTask( | 118 base::MessageLoopProxy::current()->PostTask( |
119 FROM_HERE, | 119 FROM_HERE, |
120 base::Bind(&MockStorageClient::RunDeleteOriginData, | 120 base::Bind(&MockStorageClient::RunDeleteOriginData, |
121 weak_factory_.GetWeakPtr(), origin, type, callback)); | 121 weak_factory_.GetWeakPtr(), origin, type, callback)); |
122 } | 122 } |
123 | 123 |
| 124 bool MockStorageClient::DoesSupport(quota::StorageType type) const { |
| 125 return true; |
| 126 } |
| 127 |
124 void MockStorageClient::RunGetOriginUsage( | 128 void MockStorageClient::RunGetOriginUsage( |
125 const GURL& origin_url, StorageType type, | 129 const GURL& origin_url, StorageType type, |
126 const GetUsageCallback& callback) { | 130 const GetUsageCallback& callback) { |
127 OriginDataMap::iterator find = origin_data_.find(make_pair(origin_url, type)); | 131 OriginDataMap::iterator find = origin_data_.find(make_pair(origin_url, type)); |
128 if (find == origin_data_.end()) { | 132 if (find == origin_data_.end()) { |
129 callback.Run(0); | 133 callback.Run(0); |
130 } else { | 134 } else { |
131 callback.Run(find->second); | 135 callback.Run(find->second); |
132 } | 136 } |
133 } | 137 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 int64 delta = itr->second; | 177 int64 delta = itr->second; |
174 quota_manager_proxy_-> | 178 quota_manager_proxy_-> |
175 NotifyStorageModified(id(), origin_url, type, -delta); | 179 NotifyStorageModified(id(), origin_url, type, -delta); |
176 origin_data_.erase(itr); | 180 origin_data_.erase(itr); |
177 } | 181 } |
178 | 182 |
179 callback.Run(kQuotaStatusOk); | 183 callback.Run(kQuotaStatusOk); |
180 } | 184 } |
181 | 185 |
182 } // namespace quota | 186 } // namespace quota |
OLD | NEW |