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

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

Issue 6810037: File API changes needed for safely passing user selected file entities from the file browser comp... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 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 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 "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "webkit/quota/special_storage_policy.h" 14 #include "webkit/quota/special_storage_policy.h"
15 15
16 class Extension; 16 class Extension;
17 17
18 // Special rights are granted to 'extensions' and 'applications'. The 18 // Special rights are granted to 'extensions' and 'applications'. The
19 // storage subsystems and the browsing data remover query this interface 19 // storage subsystems and the browsing data remover query this interface
20 // to determine which origins have these rights. 20 // to determine which origins have these rights.
21 class ExtensionSpecialStoragePolicy : public quota::SpecialStoragePolicy { 21 class ExtensionSpecialStoragePolicy : public quota::SpecialStoragePolicy {
22 public: 22 public:
23 ExtensionSpecialStoragePolicy(); 23 ExtensionSpecialStoragePolicy();
24 24
25 // SpecialStoragePolicy methods used by storage subsystems and the browsing 25 // SpecialStoragePolicy methods used by storage subsystems and the browsing
26 // data remover. These methods are safe to call on any thread. 26 // data remover. These methods are safe to call on any thread.
27 virtual bool IsStorageProtected(const GURL& origin); 27 virtual bool IsStorageProtected(const GURL& origin);
28 virtual bool IsStorageUnlimited(const GURL& origin); 28 virtual bool IsStorageUnlimited(const GURL& origin);
29 virtual bool IsLocalFileSystemAccessAllowed(const GURL& origin); 29 virtual bool IsFileHandler(const std::string& extension_id);
30 30
31 // Methods used by the ExtensionService to populate this class. 31 // Methods used by the ExtensionService to populate this class.
32 void GrantRightsForExtension(const Extension* extension); 32 void GrantRightsForExtension(const Extension* extension);
33 void RevokeRightsForExtension(const Extension* extension); 33 void RevokeRightsForExtension(const Extension* extension);
34 void RevokeRightsForAllExtensions(); 34 void RevokeRightsForAllExtensions();
35 35
36 private: 36 private:
37 class SpecialCollection { 37 class SpecialCollection {
38 public: 38 public:
39 SpecialCollection(); 39 SpecialCollection();
40 ~SpecialCollection(); 40 ~SpecialCollection();
41 41
42 bool Contains(const GURL& origin); 42 bool Contains(const GURL& origin);
43 bool ContainsExtension(const std::string& extension_id);
43 void Add(const Extension* extension); 44 void Add(const Extension* extension);
44 void Remove(const Extension* extension); 45 void Remove(const Extension* extension);
45 void Clear(); 46 void Clear();
46 47
47 private: 48 private:
48 typedef std::map<GURL, bool> CachedResults; 49 typedef std::map<GURL, bool> CachedResults;
49 typedef std::map<std::string, scoped_refptr<const Extension> > Extensions; 50 typedef std::map<std::string, scoped_refptr<const Extension> > Extensions;
50 Extensions extensions_; 51 Extensions extensions_;
51 CachedResults cached_resuts_; 52 CachedResults cached_results_;
52 }; 53 };
53 54
54 virtual ~ExtensionSpecialStoragePolicy(); 55 virtual ~ExtensionSpecialStoragePolicy();
55 56
56 base::Lock lock_; // Synchronize all access to the collections. 57 base::Lock lock_; // Synchronize all access to the collections.
57 SpecialCollection protected_apps_; 58 SpecialCollection protected_apps_;
58 SpecialCollection unlimited_extensions_; 59 SpecialCollection unlimited_extensions_;
59 SpecialCollection local_filesystem_extensions_; 60 SpecialCollection file_handler_extensions_;
60 }; 61 };
61 62
62 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ 63 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_special_storage_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698