| OLD | NEW |
| 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_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 12 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 | 14 |
| 15 // This class is the same as MockSpecialStoragePolicy (in | 15 // This class is the same as MockSpecialStoragePolicy (in |
| 16 // webkit/quota/mock_special_storage_policy.h), but it inherits | 16 // webkit/quota/mock_special_storage_policy.h), but it inherits |
| 17 // ExtensionSpecialStoragePolicy instead of quota::SpecialStoragePolicy. | 17 // ExtensionSpecialStoragePolicy instead of quota::SpecialStoragePolicy. |
| 18 class MockExtensionSpecialStoragePolicy : public ExtensionSpecialStoragePolicy { | 18 class MockExtensionSpecialStoragePolicy : public ExtensionSpecialStoragePolicy { |
| 19 public: | 19 public: |
| 20 MockExtensionSpecialStoragePolicy(); | 20 MockExtensionSpecialStoragePolicy(); |
| 21 virtual ~MockExtensionSpecialStoragePolicy(); | 21 virtual ~MockExtensionSpecialStoragePolicy(); |
| 22 | 22 |
| 23 virtual bool IsStorageProtected(const GURL& origin); | 23 virtual bool IsStorageProtected(const GURL& origin); |
| 24 virtual bool IsStorageUnlimited(const GURL& origin); | 24 virtual bool IsStorageUnlimited(const GURL& origin); |
| 25 virtual bool IsStorageSessionOnly(const GURL& origin); |
| 25 virtual bool IsFileHandler(const std::string& extension_id); | 26 virtual bool IsFileHandler(const std::string& extension_id); |
| 26 | 27 |
| 27 void AddProtected(const GURL& origin) { | 28 void AddProtected(const GURL& origin) { |
| 28 protected_.insert(origin); | 29 protected_.insert(origin); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void AddUnlimited(const GURL& origin) { | 32 void AddUnlimited(const GURL& origin) { |
| 32 unlimited_.insert(origin); | 33 unlimited_.insert(origin); |
| 33 } | 34 } |
| 34 | 35 |
| 36 void AddSessionOnly(const GURL& origin) { |
| 37 session_only_.insert(origin); |
| 38 } |
| 39 |
| 35 void AddFileHandler(const std::string& id) { | 40 void AddFileHandler(const std::string& id) { |
| 36 file_handlers_.insert(id); | 41 file_handlers_.insert(id); |
| 37 } | 42 } |
| 38 | 43 |
| 39 void Reset() { | 44 void Reset() { |
| 40 protected_.clear(); | 45 protected_.clear(); |
| 41 unlimited_.clear(); | 46 unlimited_.clear(); |
| 47 session_only_.clear(); |
| 42 file_handlers_.clear(); | 48 file_handlers_.clear(); |
| 43 } | 49 } |
| 44 | 50 |
| 45 private: | 51 private: |
| 46 std::set<GURL> protected_; | 52 std::set<GURL> protected_; |
| 47 std::set<GURL> unlimited_; | 53 std::set<GURL> unlimited_; |
| 54 std::set<GURL> session_only_; |
| 48 std::set<std::string> file_handlers_; | 55 std::set<std::string> file_handlers_; |
| 49 | 56 |
| 50 DISALLOW_COPY_AND_ASSIGN(MockExtensionSpecialStoragePolicy); | 57 DISALLOW_COPY_AND_ASSIGN(MockExtensionSpecialStoragePolicy); |
| 51 }; | 58 }; |
| 52 | 59 |
| 53 #endif // CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_ | 60 #endif // CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_ |
| OLD | NEW |