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

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

Issue 7618025: Send notifications on the IO thread when changes are made to the special storage policy. Listen f... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « webkit/quota/quota_manager_unittest.cc ('k') | webkit/quota/special_storage_policy.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_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 12
12 class GURL; 13 class GURL;
13 14
14 namespace quota { 15 namespace quota {
15 16
16 // Special rights are granted to 'extensions' and 'applications'. The 17 // Special rights are granted to 'extensions' and 'applications'. The
17 // storage subsystems query this interface to determine which origins 18 // storage subsystems query this interface to determine which origins
18 // 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
19 // is currently installed in the extensions system. 20 // is currently installed in the extensions system.
20 // An implementation must be thread-safe. 21 // The IsSomething() methods must be thread-safe, however Observers should
22 // only be notified, added, and removed on the IO thead.
21 class SpecialStoragePolicy 23 class SpecialStoragePolicy
22 : public base::RefCountedThreadSafe<SpecialStoragePolicy> { 24 : public base::RefCountedThreadSafe<SpecialStoragePolicy> {
23 public: 25 public:
26 class Observer {
27 public:
28 virtual void OnSpecialStoragePolicyChanged() = 0;
29 protected:
30 virtual ~Observer();
31 };
32
24 SpecialStoragePolicy(); 33 SpecialStoragePolicy();
25 34
26 // Protected storage is not subject to removal by the browsing data remover. 35 // Protected storage is not subject to removal by the browsing data remover.
27 virtual bool IsStorageProtected(const GURL& origin) = 0; 36 virtual bool IsStorageProtected(const GURL& origin) = 0;
28 37
29 // Unlimited storage is not subject to 'quotas'. 38 // Unlimited storage is not subject to 'quotas'.
30 virtual bool IsStorageUnlimited(const GURL& origin) = 0; 39 virtual bool IsStorageUnlimited(const GURL& origin) = 0;
31 40
32 // Checks if extension identified with |extension_id| is registered as 41 // Checks if extension identified with |extension_id| is registered as
33 // file handler. 42 // file handler.
34 virtual bool IsFileHandler(const std::string& extension_id) = 0; 43 virtual bool IsFileHandler(const std::string& extension_id) = 0;
35 44
45 // Adds/removes an observer, the policy does not take
46 // ownership of the observer. Should only be called on the IO thread.
47 void AddObserver(Observer* observer);
48 void RemoveObserver(Observer* observer);
49
36 protected: 50 protected:
37 friend class base::RefCountedThreadSafe<SpecialStoragePolicy>; 51 friend class base::RefCountedThreadSafe<SpecialStoragePolicy>;
38 virtual ~SpecialStoragePolicy(); 52 virtual ~SpecialStoragePolicy();
53 void NotifyObservers();
54
55 ObserverList<Observer> observers_;
39 }; 56 };
40 57
41 } // namespace quota 58 } // namespace quota
42 59
43 #endif // WEBKIT_QUOTA_SPECIAL_STORAGE_POLICY_H_ 60 #endif // WEBKIT_QUOTA_SPECIAL_STORAGE_POLICY_H_
OLDNEW
« no previous file with comments | « webkit/quota/quota_manager_unittest.cc ('k') | webkit/quota/special_storage_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698