OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "extensions/common/extension_set.h" | 12 #include "extensions/common/extension_set.h" |
13 #include "storage/browser/quota/special_storage_policy.h" | 13 #include "storage/browser/quota/special_storage_policy.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 class CookieSettings; | 16 class CookieSettings; |
17 | 17 |
| 18 namespace content { |
| 19 class BrowserContext; |
| 20 } |
| 21 |
18 namespace extensions { | 22 namespace extensions { |
19 class Extension; | 23 class Extension; |
20 } | 24 } |
21 | 25 |
22 // Special rights are granted to 'extensions' and 'applications'. The | 26 // Special rights are granted to 'extensions' and 'applications'. The |
23 // storage subsystems and the browsing data remover query this interface | 27 // storage subsystems and the browsing data remover query this interface |
24 // to determine which origins have these rights. | 28 // to determine which origins have these rights. |
25 class ExtensionSpecialStoragePolicy : public storage::SpecialStoragePolicy { | 29 class ExtensionSpecialStoragePolicy : public storage::SpecialStoragePolicy { |
26 public: | 30 public: |
27 explicit ExtensionSpecialStoragePolicy(CookieSettings* cookie_settings); | 31 explicit ExtensionSpecialStoragePolicy(CookieSettings* cookie_settings); |
28 | 32 |
29 // storage::SpecialStoragePolicy methods used by storage subsystems and the | 33 // storage::SpecialStoragePolicy methods used by storage subsystems and the |
30 // browsing data remover. These methods are safe to call on any thread. | 34 // browsing data remover. These methods are safe to call on any thread. |
31 virtual bool IsStorageProtected(const GURL& origin) OVERRIDE; | 35 virtual bool IsStorageProtected(const GURL& origin) OVERRIDE; |
32 virtual bool IsStorageUnlimited(const GURL& origin) OVERRIDE; | 36 virtual bool IsStorageUnlimited(const GURL& origin) OVERRIDE; |
33 virtual bool IsStorageSessionOnly(const GURL& origin) OVERRIDE; | 37 virtual bool IsStorageSessionOnly(const GURL& origin) OVERRIDE; |
34 virtual bool CanQueryDiskSize(const GURL& origin) OVERRIDE; | 38 virtual bool CanQueryDiskSize(const GURL& origin) OVERRIDE; |
35 virtual bool IsFileHandler(const std::string& extension_id) OVERRIDE; | 39 virtual bool IsFileHandler(const std::string& extension_id) OVERRIDE; |
36 virtual bool HasIsolatedStorage(const GURL& origin) OVERRIDE; | 40 virtual bool HasIsolatedStorage(const GURL& origin) OVERRIDE; |
37 virtual bool HasSessionOnlyOrigins() OVERRIDE; | 41 virtual bool HasSessionOnlyOrigins() OVERRIDE; |
38 | 42 |
39 // Methods used by the ExtensionService to populate this class. | 43 // Methods used by the ExtensionService to populate this class. |
40 void GrantRightsForExtension(const extensions::Extension* extension); | 44 void GrantRightsForExtension(const extensions::Extension* extension, |
| 45 content::BrowserContext* browser_context); |
41 void RevokeRightsForExtension(const extensions::Extension* extension); | 46 void RevokeRightsForExtension(const extensions::Extension* extension); |
42 void RevokeRightsForAllExtensions(); | 47 void RevokeRightsForAllExtensions(); |
43 | 48 |
44 // Decides whether the storage for |extension|'s web extent needs protection. | 49 // Decides whether the storage for |extension|'s web extent needs protection. |
45 bool NeedsProtection(const extensions::Extension* extension); | 50 bool NeedsProtection(const extensions::Extension* extension); |
46 | 51 |
47 // Returns the set of extensions protecting this origin. The caller does not | 52 // Returns the set of extensions protecting this origin. The caller does not |
48 // take ownership of the return value. | 53 // take ownership of the return value. |
49 const extensions::ExtensionSet* ExtensionsProtectingOrigin( | 54 const extensions::ExtensionSet* ExtensionsProtectingOrigin( |
50 const GURL& origin); | 55 const GURL& origin); |
(...skipping 30 matching lines...) Expand all Loading... |
81 base::Lock lock_; // Synchronize all access to the collections. | 86 base::Lock lock_; // Synchronize all access to the collections. |
82 SpecialCollection protected_apps_; | 87 SpecialCollection protected_apps_; |
83 SpecialCollection installed_apps_; | 88 SpecialCollection installed_apps_; |
84 SpecialCollection unlimited_extensions_; | 89 SpecialCollection unlimited_extensions_; |
85 SpecialCollection file_handler_extensions_; | 90 SpecialCollection file_handler_extensions_; |
86 SpecialCollection isolated_extensions_; | 91 SpecialCollection isolated_extensions_; |
87 scoped_refptr<CookieSettings> cookie_settings_; | 92 scoped_refptr<CookieSettings> cookie_settings_; |
88 }; | 93 }; |
89 | 94 |
90 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ | 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ |
OLD | NEW |