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

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 <set>
michaeln 2011/04/14 21:25:34 needed?
zel 2011/04/14 21:46:20 Done.
10 #include <string> 11 #include <string>
11 12
13 #include "base/file_path.h"
michaeln 2011/04/14 21:25:34 needed?
zel 2011/04/14 21:46:20 Done.
12 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
13 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
14 #include "webkit/quota/special_storage_policy.h" 16 #include "webkit/quota/special_storage_policy.h"
15 17
16 class Extension; 18 class Extension;
17 19
18 // Special rights are granted to 'extensions' and 'applications'. The 20 // Special rights are granted to 'extensions' and 'applications'. The
19 // storage subsystems and the browsing data remover query this interface 21 // storage subsystems and the browsing data remover query this interface
20 // to determine which origins have these rights. 22 // to determine which origins have these rights.
21 class ExtensionSpecialStoragePolicy : public quota::SpecialStoragePolicy { 23 class ExtensionSpecialStoragePolicy : public quota::SpecialStoragePolicy {
22 public: 24 public:
23 ExtensionSpecialStoragePolicy(); 25 ExtensionSpecialStoragePolicy();
24 26
25 // SpecialStoragePolicy methods used by storage subsystems and the browsing 27 // SpecialStoragePolicy methods used by storage subsystems and the browsing
26 // data remover. These methods are safe to call on any thread. 28 // data remover. These methods are safe to call on any thread.
27 virtual bool IsStorageProtected(const GURL& origin); 29 virtual bool IsStorageProtected(const GURL& origin);
28 virtual bool IsStorageUnlimited(const GURL& origin); 30 virtual bool IsStorageUnlimited(const GURL& origin);
29 virtual bool IsLocalFileSystemAccessAllowed(const GURL& origin); 31 virtual bool IsFileHanlder(const std::string& extension_id);
michaeln 2011/04/14 21:25:34 typo... IsFileHandler
zel 2011/04/14 21:46:20 Done.
30 32
31 // Methods used by the ExtensionService to populate this class. 33 // Methods used by the ExtensionService to populate this class.
32 void GrantRightsForExtension(const Extension* extension); 34 void GrantRightsForExtension(const Extension* extension);
33 void RevokeRightsForExtension(const Extension* extension); 35 void RevokeRightsForExtension(const Extension* extension);
34 void RevokeRightsForAllExtensions(); 36 void RevokeRightsForAllExtensions();
35 37
36 private: 38 private:
37 class SpecialCollection { 39 class SpecialCollection {
38 public: 40 public:
39 SpecialCollection(); 41 SpecialCollection();
40 ~SpecialCollection(); 42 virtual ~SpecialCollection();
michaeln 2011/04/14 21:25:34 this can be de-virtualized now
zel 2011/04/14 21:46:20 Done.
41 43
42 bool Contains(const GURL& origin); 44 bool Contains(const GURL& origin);
43 void Add(const Extension* extension); 45 void Add(const Extension* extension);
44 void Remove(const Extension* extension); 46 void Remove(const Extension* extension);
45 void Clear(); 47 void Clear();
48 bool ContainsExtension(const std::string& extension_id);
michaeln 2011/04/14 21:25:34 nit: move this method declaration up under Contain
zel 2011/04/14 21:46:20 Done.
46 49
47 private: 50 protected:
michaeln 2011/04/14 21:25:34 can remain private
zel 2011/04/14 21:46:20 Done.
48 typedef std::map<GURL, bool> CachedResults; 51 typedef std::map<GURL, bool> CachedResults;
49 typedef std::map<std::string, scoped_refptr<const Extension> > Extensions; 52 typedef std::map<std::string, scoped_refptr<const Extension> > Extensions;
50 Extensions extensions_; 53 Extensions extensions_;
51 CachedResults cached_resuts_; 54 CachedResults cached_results_;
52 }; 55 };
53 56
54 virtual ~ExtensionSpecialStoragePolicy(); 57 virtual ~ExtensionSpecialStoragePolicy();
55 58
56 base::Lock lock_; // Synchronize all access to the collections. 59 base::Lock lock_; // Synchronize all access to the collections.
57 SpecialCollection protected_apps_; 60 SpecialCollection protected_apps_;
58 SpecialCollection unlimited_extensions_; 61 SpecialCollection unlimited_extensions_;
59 SpecialCollection local_filesystem_extensions_; 62 SpecialCollection file_handler_extensions_;
60 }; 63 };
61 64
62 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_ 65 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698