Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: webkit/quota/mock_storage_client.h

Issue 8070001: Use base::Callback in Quota related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/quota/mock_quota_manager_unittest.cc ('k') | webkit/quota/mock_storage_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ 5 #ifndef WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_
6 #define WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ 6 #define WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <utility>
11 12
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/task.h" 14 #include "base/task.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 #include "webkit/quota/quota_client.h" 17 #include "webkit/quota/quota_client.h"
17 18
18 namespace quota { 19 namespace quota {
19 20
20 class QuotaManagerProxy; 21 class QuotaManagerProxy;
(...skipping 20 matching lines...) Expand all
41 42
42 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); 43 void AddOriginToErrorSet(const GURL& origin_url, StorageType type);
43 44
44 base::Time IncrementMockTime(); 45 base::Time IncrementMockTime();
45 46
46 // QuotaClient methods. 47 // QuotaClient methods.
47 virtual QuotaClient::ID id() const OVERRIDE; 48 virtual QuotaClient::ID id() const OVERRIDE;
48 virtual void OnQuotaManagerDestroyed() OVERRIDE; 49 virtual void OnQuotaManagerDestroyed() OVERRIDE;
49 virtual void GetOriginUsage(const GURL& origin_url, 50 virtual void GetOriginUsage(const GURL& origin_url,
50 StorageType type, 51 StorageType type,
51 GetUsageCallback* callback) OVERRIDE; 52 const GetUsageCallback& callback) OVERRIDE;
52 virtual void GetOriginsForType(StorageType type, 53 virtual void GetOriginsForType(StorageType type,
53 GetOriginsCallback* callback) OVERRIDE; 54 const GetOriginsCallback& callback) OVERRIDE;
54 virtual void GetOriginsForHost(StorageType type, const std::string& host, 55 virtual void GetOriginsForHost(StorageType type, const std::string& host,
55 GetOriginsCallback* callback) OVERRIDE; 56 const GetOriginsCallback& callback) OVERRIDE;
56 virtual void DeleteOriginData(const GURL& origin, 57 virtual void DeleteOriginData(const GURL& origin,
57 StorageType type, 58 StorageType type,
58 DeletionCallback* callback) OVERRIDE; 59 const DeletionCallback& callback) OVERRIDE;
59 60
60 private: 61 private:
61 void RunGetOriginUsage(const GURL& origin_url, 62 void RunGetOriginUsage(const GURL& origin_url,
62 StorageType type, 63 StorageType type,
63 GetUsageCallback* callback); 64 const GetUsageCallback& callback);
64 void RunGetOriginsForType(StorageType type, 65 void RunGetOriginsForType(StorageType type,
65 GetOriginsCallback* callback); 66 const GetOriginsCallback& callback);
66 void RunGetOriginsForHost(StorageType type, 67 void RunGetOriginsForHost(StorageType type,
67 const std::string& host, 68 const std::string& host,
68 GetOriginsCallback* callback); 69 const GetOriginsCallback& callback);
69 void RunDeleteOriginData(const GURL& origin_url, 70 void RunDeleteOriginData(const GURL& origin_url,
70 StorageType type, 71 StorageType type,
71 DeletionCallback* callback); 72 const DeletionCallback& callback);
72 73
73 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; 74 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
74 const ID id_; 75 const ID id_;
75 76
76 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap; 77 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap;
77 OriginDataMap origin_data_; 78 OriginDataMap origin_data_;
78 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet; 79 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet;
79 ErrorOriginSet error_origins_; 80 ErrorOriginSet error_origins_;
80 81
81 std::set<GetUsageCallback*> usage_callbacks_;
82 std::set<GetOriginsCallback*> origins_callbacks_;
83 std::set<DeletionCallback*> deletion_callbacks_;
84
85 int mock_time_counter_; 82 int mock_time_counter_;
86 83
87 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_; 84 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_;
88 85
89 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); 86 DISALLOW_COPY_AND_ASSIGN(MockStorageClient);
90 }; 87 };
91 88
92 } // namespace quota 89 } // namespace quota
93 90
94 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ 91 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_
OLDNEW
« no previous file with comments | « webkit/quota/mock_quota_manager_unittest.cc ('k') | webkit/quota/mock_storage_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698