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

Side by Side Diff: chrome/browser/extensions/extension_special_storage_policy.h

Issue 10709006: Show apps protecting local data in chrome://settings/cookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "chrome/common/extensions/extension_set.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 #include "webkit/quota/special_storage_policy.h" 15 #include "webkit/quota/special_storage_policy.h"
15 16
16 class CookieSettings; 17 class CookieSettings;
17 18
18 namespace extensions { 19 namespace extensions {
19 class Extension; 20 class Extension;
20 } 21 }
21 22
22 // Special rights are granted to 'extensions' and 'applications'. The 23 // Special rights are granted to 'extensions' and 'applications'. The
(...skipping 12 matching lines...) Expand all
35 virtual bool HasSessionOnlyOrigins() OVERRIDE; 36 virtual bool HasSessionOnlyOrigins() OVERRIDE;
36 37
37 // Methods used by the ExtensionService to populate this class. 38 // Methods used by the ExtensionService to populate this class.
38 void GrantRightsForExtension(const extensions::Extension* extension); 39 void GrantRightsForExtension(const extensions::Extension* extension);
39 void RevokeRightsForExtension(const extensions::Extension* extension); 40 void RevokeRightsForExtension(const extensions::Extension* extension);
40 void RevokeRightsForAllExtensions(); 41 void RevokeRightsForAllExtensions();
41 42
42 // Decides whether the storage for |extension|'s web extent needs protection. 43 // Decides whether the storage for |extension|'s web extent needs protection.
43 bool NeedsProtection(const extensions::Extension* extension); 44 bool NeedsProtection(const extensions::Extension* extension);
44 45
46 // Returns the set of extensions protecting this origin.
47 const ExtensionSet* ExtensionsProtectingOrigin(const GURL& origin);
marja 2012/07/09 08:11:43 Caller doesn't take ownership of the returned poin
Bernhard Bauer 2012/07/09 09:50:48 Hm, I usually assume that the default is that the
marja 2012/07/09 09:55:02 Yes, true, the default might be no-ownership-trans
48
45 protected: 49 protected:
46 virtual ~ExtensionSpecialStoragePolicy(); 50 virtual ~ExtensionSpecialStoragePolicy();
47 51
48 private: 52 private:
49 class SpecialCollection { 53 class SpecialCollection {
50 public: 54 public:
51 SpecialCollection(); 55 SpecialCollection();
52 ~SpecialCollection(); 56 ~SpecialCollection();
53 57
54 bool Contains(const GURL& origin); 58 bool Contains(const GURL& origin);
59 const ExtensionSet* ExtensionsContaining(const GURL& origin);
55 bool ContainsExtension(const std::string& extension_id); 60 bool ContainsExtension(const std::string& extension_id);
56 void Add(const extensions::Extension* extension); 61 void Add(const extensions::Extension* extension);
57 void Remove(const extensions::Extension* extension); 62 void Remove(const extensions::Extension* extension);
58 void Clear(); 63 void Clear();
59 64
60 private: 65 private:
61 typedef std::map<GURL, bool> CachedResults; 66 typedef std::map<GURL, ExtensionSet*> CachedResults;
62 typedef std::map<std::string, scoped_refptr<const extensions::Extension> > 67
63 Extensions; 68 void ClearCache();
64 Extensions extensions_; 69
70 ExtensionSet extensions_;
65 CachedResults cached_results_; 71 CachedResults cached_results_;
66 }; 72 };
67 73
68 void NotifyChanged(); 74 void NotifyChanged();
69 75
70 base::Lock lock_; // Synchronize all access to the collections. 76 base::Lock lock_; // Synchronize all access to the collections.
71 SpecialCollection protected_apps_; 77 SpecialCollection protected_apps_;
72 SpecialCollection unlimited_extensions_; 78 SpecialCollection unlimited_extensions_;
73 SpecialCollection file_handler_extensions_; 79 SpecialCollection file_handler_extensions_;
74 scoped_refptr<CookieSettings> cookie_settings_; 80 scoped_refptr<CookieSettings> cookie_settings_;
75 }; 81 };
76 82
77 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ 83 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698