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

Side by Side Diff: storage/browser/quota/storage_observer.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | « storage/browser/quota/storage_monitor.cc ('k') | storage/browser/quota/storage_observer.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 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 #ifndef WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ 5 #ifndef WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_
6 #define WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ 6 #define WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 #include "webkit/browser/quota/quota_client.h" 11 #include "storage/browser/quota/quota_client.h"
12 #include "webkit/common/quota/quota_types.h" 12 #include "storage/common/quota/quota_types.h"
13 13
14 namespace quota { 14 namespace quota {
15 15
16 // This interface is implemented by observers that wish to monitor storage 16 // This interface is implemented by observers that wish to monitor storage
17 // events, such as changes in quota or usage. 17 // events, such as changes in quota or usage.
18 class WEBKIT_STORAGE_BROWSER_EXPORT StorageObserver { 18 class STORAGE_EXPORT StorageObserver {
19 public: 19 public:
20 struct WEBKIT_STORAGE_BROWSER_EXPORT Filter { 20 struct STORAGE_EXPORT Filter {
21 // The storage type to monitor. This must not be kStorageTypeUnknown or 21 // The storage type to monitor. This must not be kStorageTypeUnknown or
22 // kStorageTypeQuotaNotManaged. 22 // kStorageTypeQuotaNotManaged.
23 StorageType storage_type; 23 StorageType storage_type;
24 24
25 // The origin to monitor usage for. Must be specified. 25 // The origin to monitor usage for. Must be specified.
26 GURL origin; 26 GURL origin;
27 27
28 Filter(); 28 Filter();
29 Filter(StorageType storage_type, const GURL& origin); 29 Filter(StorageType storage_type, const GURL& origin);
30 bool operator==(const Filter& other) const; 30 bool operator==(const Filter& other) const;
31 }; 31 };
32 32
33 struct WEBKIT_STORAGE_BROWSER_EXPORT MonitorParams { 33 struct STORAGE_EXPORT MonitorParams {
34 // Storage type and origin to monitor. 34 // Storage type and origin to monitor.
35 Filter filter; 35 Filter filter;
36 36
37 // The rate at which storage events will be fired. Events will be fired at 37 // The rate at which storage events will be fired. Events will be fired at
38 // approximately this rate, or when a storage status change has been 38 // approximately this rate, or when a storage status change has been
39 // detected, whichever is the least frequent. 39 // detected, whichever is the least frequent.
40 base::TimeDelta rate; 40 base::TimeDelta rate;
41 41
42 // If set to true, the observer will be dispatched an event when added. 42 // If set to true, the observer will be dispatched an event when added.
43 bool dispatch_initial_state; 43 bool dispatch_initial_state;
44 44
45 MonitorParams(); 45 MonitorParams();
46 MonitorParams(StorageType storage_type, 46 MonitorParams(StorageType storage_type,
47 const GURL& origin, 47 const GURL& origin,
48 const base::TimeDelta& rate, 48 const base::TimeDelta& rate,
49 bool get_initial_state); 49 bool get_initial_state);
50 MonitorParams(const Filter& filter, 50 MonitorParams(const Filter& filter,
51 const base::TimeDelta& rate, 51 const base::TimeDelta& rate,
52 bool get_initial_state); 52 bool get_initial_state);
53 }; 53 };
54 54
55 struct WEBKIT_STORAGE_BROWSER_EXPORT Event { 55 struct STORAGE_EXPORT Event {
56 // The storage type and origin monitored. 56 // The storage type and origin monitored.
57 Filter filter; 57 Filter filter;
58 58
59 // The current usage corresponding to the filter. 59 // The current usage corresponding to the filter.
60 int64 usage; 60 int64 usage;
61 61
62 // The quota corresponding to the filter. 62 // The quota corresponding to the filter.
63 int64 quota; 63 int64 quota;
64 64
65 Event(); 65 Event();
66 Event(const Filter& filter, int64 usage, int64 quota); 66 Event(const Filter& filter, int64 usage, int64 quota);
67 bool operator==(const Event& other) const; 67 bool operator==(const Event& other) const;
68 }; 68 };
69 69
70 // Will be called on the IO thread when a storage event occurs. 70 // Will be called on the IO thread when a storage event occurs.
71 virtual void OnStorageEvent(const Event& event) = 0; 71 virtual void OnStorageEvent(const Event& event) = 0;
72 72
73 protected: 73 protected:
74 virtual ~StorageObserver() {} 74 virtual ~StorageObserver() {}
75 }; 75 };
76 76
77 } // namespace quota 77 } // namespace quota
78 78
79 #endif // WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ 79 #endif // WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_
OLDNEW
« no previous file with comments | « storage/browser/quota/storage_monitor.cc ('k') | storage/browser/quota/storage_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698