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