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 #ifndef WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_ | 5 #ifndef WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_ |
6 #define WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_ | 6 #define WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "webkit/browser/webkit_storage_browser_export.h" | 12 #include "storage/common/storage_export.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace quota { | 16 namespace quota { |
17 | 17 |
18 // Special rights are granted to 'extensions' and 'applications'. The | 18 // Special rights are granted to 'extensions' and 'applications'. The |
19 // storage subsystems query this interface to determine which origins | 19 // storage subsystems query this interface to determine which origins |
20 // have these rights. Chrome provides an impl that is cognizant of what | 20 // have these rights. Chrome provides an impl that is cognizant of what |
21 // is currently installed in the extensions system. | 21 // is currently installed in the extensions system. |
22 // The IsSomething() methods must be thread-safe, however Observers should | 22 // The IsSomething() methods must be thread-safe, however Observers should |
23 // only be notified, added, and removed on the IO thead. | 23 // only be notified, added, and removed on the IO thead. |
24 class WEBKIT_STORAGE_BROWSER_EXPORT SpecialStoragePolicy | 24 class STORAGE_EXPORT SpecialStoragePolicy |
25 : public base::RefCountedThreadSafe<SpecialStoragePolicy> { | 25 : public base::RefCountedThreadSafe<SpecialStoragePolicy> { |
26 public: | 26 public: |
27 typedef int StoragePolicy; | 27 typedef int StoragePolicy; |
28 enum ChangeFlags { | 28 enum ChangeFlags { |
29 STORAGE_PROTECTED = 1 << 0, | 29 STORAGE_PROTECTED = 1 << 0, |
30 STORAGE_UNLIMITED = 1 << 1, | 30 STORAGE_UNLIMITED = 1 << 1, |
31 }; | 31 }; |
32 | 32 |
33 class WEBKIT_STORAGE_BROWSER_EXPORT Observer { | 33 class STORAGE_EXPORT Observer { |
34 public: | 34 public: |
35 virtual void OnGranted(const GURL& origin, int change_flags) = 0; | 35 virtual void OnGranted(const GURL& origin, int change_flags) = 0; |
36 virtual void OnRevoked(const GURL& origin, int change_flags) = 0; | 36 virtual void OnRevoked(const GURL& origin, int change_flags) = 0; |
37 virtual void OnCleared() = 0; | 37 virtual void OnCleared() = 0; |
38 | 38 |
39 protected: | 39 protected: |
40 virtual ~Observer(); | 40 virtual ~Observer(); |
41 }; | 41 }; |
42 | 42 |
43 SpecialStoragePolicy(); | 43 SpecialStoragePolicy(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void NotifyGranted(const GURL& origin, int change_flags); | 77 void NotifyGranted(const GURL& origin, int change_flags); |
78 void NotifyRevoked(const GURL& origin, int change_flags); | 78 void NotifyRevoked(const GURL& origin, int change_flags); |
79 void NotifyCleared(); | 79 void NotifyCleared(); |
80 | 80 |
81 ObserverList<Observer> observers_; | 81 ObserverList<Observer> observers_; |
82 }; | 82 }; |
83 | 83 |
84 } // namespace quota | 84 } // namespace quota |
85 | 85 |
86 #endif // WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_ | 86 #endif // WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_ |
OLD | NEW |