| Index: chrome/browser/extensions/extension_special_storage_policy.h
|
| ===================================================================
|
| --- chrome/browser/extensions/extension_special_storage_policy.h (revision 80410)
|
| +++ chrome/browser/extensions/extension_special_storage_policy.h (working copy)
|
| @@ -9,6 +9,7 @@
|
| #include <map>
|
| #include <set>
|
|
|
| +#include "base/file_path.h"
|
| #include "base/synchronization/lock.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "webkit/quota/special_storage_policy.h"
|
| @@ -26,7 +27,10 @@
|
| // data remover. These methods are safe to call on any thread.
|
| virtual bool IsStorageProtected(const GURL& origin);
|
| virtual bool IsStorageUnlimited(const GURL& origin);
|
| - virtual bool IsLocalFileSystemAccessAllowed(const GURL& origin);
|
| + virtual bool IsLocalFileSystemAccessAllowed(const GURL& origin,
|
| + const FilePath& virtual_path);
|
| + virtual void GrantLocalFileSystemAccess(const GURL& origin,
|
| + const FilePath& virtual_path);
|
|
|
| // Methods used by the ExtensionService to populate this class.
|
| void GrantRightsForExtension(const Extension* extension);
|
| @@ -37,26 +41,45 @@
|
| class SpecialCollection {
|
| public:
|
| SpecialCollection();
|
| - ~SpecialCollection();
|
| + virtual ~SpecialCollection();
|
|
|
| bool Contains(const GURL& origin);
|
| void Add(const Extension* extension);
|
| - void Remove(const Extension* extension);
|
| - void Clear();
|
| + virtual void Remove(const Extension* extension);
|
| + virtual void Clear();
|
|
|
| - private:
|
| + protected:
|
| typedef std::map<GURL, bool> CachedResults;
|
| typedef std::set<const Extension*> Extensions;
|
| Extensions extensions_;
|
| CachedResults cached_resuts_;
|
| };
|
|
|
| + class SpecialPathCollection : public SpecialCollection {
|
| + public:
|
| + SpecialPathCollection();
|
| + virtual ~SpecialPathCollection();
|
| +
|
| + // SpecialCollection overrides.
|
| + virtual void Remove(const Extension* extension);
|
| + virtual void Clear();
|
| +
|
| + void AddPath(const GURL& origin, const FilePath& path);
|
| + bool ContainsPath(const GURL& origin, const FilePath& path);
|
| +
|
| + private:
|
| + typedef std::set<FilePath> PathSet;
|
| + typedef std::map<const Extension*, PathSet> PathAccessMap;
|
| + const Extension* GetExtension(const GURL& origin);
|
| + PathAccessMap path_map_;
|
| + };
|
| +
|
| virtual ~ExtensionSpecialStoragePolicy();
|
|
|
| base::Lock lock_; // Synchronize all access to the collections.
|
| SpecialCollection protected_apps_;
|
| SpecialCollection unlimited_extensions_;
|
| - SpecialCollection local_filesystem_extensions_;
|
| + SpecialPathCollection local_filesystem_extensions_;
|
| };
|
|
|
| #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPECIAL_STORAGE_POLICY_H_
|
|
|