Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_SPECIAL_STORAGE_POLICY_H_ | 5 #ifndef WEBKIT_QUOTA_SPECIAL_STORAGE_POLICY_H_ |
| 6 #define WEBKIT_QUOTA_SPECIAL_STORAGE_POLICY_H_ | 6 #define WEBKIT_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 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 namespace quota { | 15 namespace quota { |
| 16 | 16 |
| 17 // Special rights are granted to 'extensions' and 'applications'. The | 17 // Special rights are granted to 'extensions' and 'applications'. The |
| 18 // storage subsystems query this interface to determine which origins | 18 // storage subsystems query this interface to determine which origins |
| 19 // have these rights. Chrome provides an impl that is cognizant of what | 19 // have these rights. Chrome provides an impl that is cognizant of what |
| 20 // is currently installed in the extensions system. | 20 // is currently installed in the extensions system. |
| 21 // The IsSomething() methods must be thread-safe, however Observers should | 21 // The IsSomething() methods must be thread-safe, however Observers should |
| 22 // only be notified, added, and removed on the IO thead. | 22 // only be notified, added, and removed on the IO thead. |
| 23 class SpecialStoragePolicy | 23 class SpecialStoragePolicy |
| 24 : public base::RefCountedThreadSafe<SpecialStoragePolicy> { | 24 : public base::RefCountedThreadSafe<SpecialStoragePolicy> { |
| 25 public: | 25 public: |
| 26 // Origins are all either protected, unprotected, or extensions. | |
| 27 enum OriginTypes { | |
| 28 UNPROTECTED_WEB = 1 << 0, | |
| 29 PROTECTED_WEB = 1 << 1, | |
| 30 EXTENSION = 1 << 2 | |
|
jochen (gone - plz use gerrit)
2012/05/24 11:34:04
stuff in webkit/ can't know about extensions :-/
| |
| 31 }; | |
| 32 | |
| 26 class Observer { | 33 class Observer { |
| 27 public: | 34 public: |
| 28 virtual void OnSpecialStoragePolicyChanged() = 0; | 35 virtual void OnSpecialStoragePolicyChanged() = 0; |
| 29 protected: | 36 protected: |
| 30 virtual ~Observer(); | 37 virtual ~Observer(); |
| 31 }; | 38 }; |
| 32 | 39 |
| 33 SpecialStoragePolicy(); | 40 SpecialStoragePolicy(); |
| 34 | 41 |
| 35 // Protected storage is not subject to removal by the browsing data remover. | 42 // Protected storage is not subject to removal by the browsing data remover. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 58 friend class base::RefCountedThreadSafe<SpecialStoragePolicy>; | 65 friend class base::RefCountedThreadSafe<SpecialStoragePolicy>; |
| 59 virtual ~SpecialStoragePolicy(); | 66 virtual ~SpecialStoragePolicy(); |
| 60 void NotifyObservers(); | 67 void NotifyObservers(); |
| 61 | 68 |
| 62 ObserverList<Observer> observers_; | 69 ObserverList<Observer> observers_; |
| 63 }; | 70 }; |
| 64 | 71 |
| 65 } // namespace quota | 72 } // namespace quota |
| 66 | 73 |
| 67 #endif // WEBKIT_QUOTA_SPECIAL_STORAGE_POLICY_H_ | 74 #endif // WEBKIT_QUOTA_SPECIAL_STORAGE_POLICY_H_ |
| OLD | NEW |