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

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

Issue 539143002: Migrate webkit/browser/ to storage/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android build Created 6 years, 3 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
OLDNEW
1 // Copyright 2013 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_SPECIAL_STORAGE_POLICY_H_ 5 #include "storage/browser/quota/special_storage_policy.h"
6 #define WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/observer_list.h"
12 #include "webkit/browser/storage_browser_export.h"
13
14 class GURL;
15
16 namespace storage {
17
18 // Special rights are granted to 'extensions' and 'applications'. The
19 // storage subsystems query this interface to determine which origins
20 // have these rights. Chrome provides an impl that is cognizant of what
21 // is currently installed in the extensions system.
22 // The IsSomething() methods must be thread-safe, however Observers should
23 // only be notified, added, and removed on the IO thead.
24 class STORAGE_EXPORT SpecialStoragePolicy
25 : public base::RefCountedThreadSafe<SpecialStoragePolicy> {
26 public:
27 typedef int StoragePolicy;
28 enum ChangeFlags {
29 STORAGE_PROTECTED = 1 << 0,
30 STORAGE_UNLIMITED = 1 << 1,
31 };
32
33 class STORAGE_EXPORT Observer {
34 public:
35 virtual void OnGranted(const GURL& origin, int change_flags) = 0;
36 virtual void OnRevoked(const GURL& origin, int change_flags) = 0;
37 virtual void OnCleared() = 0;
38
39 protected:
40 virtual ~Observer();
41 };
42
43 SpecialStoragePolicy();
44
45 // Protected storage is not subject to removal by the browsing data remover.
46 virtual bool IsStorageProtected(const GURL& origin) = 0;
47
48 // Unlimited storage is not subject to 'quotas'.
49 virtual bool IsStorageUnlimited(const GURL& origin) = 0;
50
51 // Some origins (e.g. installed apps) have access to the size of the remaining
52 // disk capacity.
53 virtual bool CanQueryDiskSize(const GURL& origin) = 0;
54
55 // Checks if extension identified with |extension_id| is registered as
56 // file handler.
57 virtual bool IsFileHandler(const std::string& extension_id) = 0;
58
59 // Checks if the origin contains per-site isolated storage.
60 virtual bool HasIsolatedStorage(const GURL& origin) = 0;
61
62 // Some origins are only allowed to store session-only data which is deleted
63 // when the session ends.
64 virtual bool IsStorageSessionOnly(const GURL& origin) = 0;
65
66 // Returns true if some origins are only allowed session-only storage.
67 virtual bool HasSessionOnlyOrigins() = 0;
68
69 // Adds/removes an observer, the policy does not take
70 // ownership of the observer. Should only be called on the IO thread.
71 void AddObserver(Observer* observer);
72 void RemoveObserver(Observer* observer);
73
74 protected:
75 friend class base::RefCountedThreadSafe<SpecialStoragePolicy>;
76 virtual ~SpecialStoragePolicy();
77 void NotifyGranted(const GURL& origin, int change_flags);
78 void NotifyRevoked(const GURL& origin, int change_flags);
79 void NotifyCleared();
80
81 ObserverList<Observer> observers_;
82 };
83
84 } // namespace storage
85
86 #endif // WEBKIT_BROWSER_QUOTA_SPECIAL_STORAGE_POLICY_H_
OLDNEW
« no previous file with comments | « webkit/browser/quota/quota_temporary_storage_evictor.cc ('k') | webkit/browser/quota/special_storage_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698