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/usage_tracker.h" | 5 #include "webkit/browser/quota/usage_tracker.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 SpecialStoragePolicy* special_storage_policy) | 272 SpecialStoragePolicy* special_storage_policy) |
273 : tracker_(tracker), | 273 : tracker_(tracker), |
274 client_(client), | 274 client_(client), |
275 type_(type), | 275 type_(type), |
276 global_limited_usage_(0), | 276 global_limited_usage_(0), |
277 global_unlimited_usage_(0), | 277 global_unlimited_usage_(0), |
278 global_usage_retrieved_(false), | 278 global_usage_retrieved_(false), |
279 special_storage_policy_(special_storage_policy) { | 279 special_storage_policy_(special_storage_policy) { |
280 DCHECK(tracker_); | 280 DCHECK(tracker_); |
281 DCHECK(client_); | 281 DCHECK(client_); |
282 if (special_storage_policy_) | 282 if (special_storage_policy_.get()) |
283 special_storage_policy_->AddObserver(this); | 283 special_storage_policy_->AddObserver(this); |
284 } | 284 } |
285 | 285 |
286 ClientUsageTracker::~ClientUsageTracker() { | 286 ClientUsageTracker::~ClientUsageTracker() { |
287 if (special_storage_policy_) | 287 if (special_storage_policy_.get()) |
288 special_storage_policy_->RemoveObserver(this); | 288 special_storage_policy_->RemoveObserver(this); |
289 } | 289 } |
290 | 290 |
291 void ClientUsageTracker::GetGlobalLimitedUsage(const UsageCallback& callback) { | 291 void ClientUsageTracker::GetGlobalLimitedUsage(const UsageCallback& callback) { |
292 if (!global_usage_retrieved_) { | 292 if (!global_usage_retrieved_) { |
293 GetGlobalUsage(base::Bind(&DidGetGlobalUsageForLimitedGlobalUsage, | 293 GetGlobalUsage(base::Bind(&DidGetGlobalUsageForLimitedGlobalUsage, |
294 callback)); | 294 callback)); |
295 return; | 295 return; |
296 } | 296 } |
297 | 297 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 } | 661 } |
662 | 662 |
663 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const { | 663 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const { |
664 if (type_ == kStorageTypeSyncable) | 664 if (type_ == kStorageTypeSyncable) |
665 return false; | 665 return false; |
666 return special_storage_policy_.get() && | 666 return special_storage_policy_.get() && |
667 special_storage_policy_->IsStorageUnlimited(origin); | 667 special_storage_policy_->IsStorageUnlimited(origin); |
668 } | 668 } |
669 | 669 |
670 } // namespace quota | 670 } // namespace quota |
OLD | NEW |