| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MANAGEMENT_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_TEST_UTIL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void ClearInstallSources(); | 40 void ClearInstallSources(); |
| 41 void AddInstallSource(const std::string& install_source); | 41 void AddInstallSource(const std::string& install_source); |
| 42 void RemoveInstallSource(const std::string& install_source); | 42 void RemoveInstallSource(const std::string& install_source); |
| 43 | 43 |
| 44 // Helper functions for 'allowed_types' manipulation. | 44 // Helper functions for 'allowed_types' manipulation. |
| 45 void UnsetAllowedTypes(); | 45 void UnsetAllowedTypes(); |
| 46 void ClearAllowedTypes(); | 46 void ClearAllowedTypes(); |
| 47 void AddAllowedType(const std::string& allowed_type); | 47 void AddAllowedType(const std::string& allowed_type); |
| 48 void RemoveAllowedType(const std::string& allowd_type); | 48 void RemoveAllowedType(const std::string& allowd_type); |
| 49 | 49 |
| 50 // Helper functions for 'blocked_permissions' manipulation. |prefix| can be |
| 51 // kWildCard or a valid extension ID. |
| 52 void UnsetBlockedPermissions(const std::string& prefix); |
| 53 void ClearBlockedPermissions(const std::string& prefix); |
| 54 void AddBlockedPermission(const std::string& prefix, |
| 55 const std::string& permission); |
| 56 void RemoveBlockedPermission(const std::string& prefix, |
| 57 const std::string& permission); |
| 58 |
| 59 // Helper functions for 'allowed_permissions' manipulation. |id| must be a |
| 60 // valid extension id. |
| 61 void UnsetAllowedPermissions(const std::string& id); |
| 62 void ClearAllowedPermissions(const std::string& id); |
| 63 void AddAllowedPermission(const std::string& id, |
| 64 const std::string& permission); |
| 65 void RemoveAllowedPermission(const std::string& id, |
| 66 const std::string& permission); |
| 67 |
| 50 // Expose a read-only preference to user. | 68 // Expose a read-only preference to user. |
| 51 const base::DictionaryValue* GetPref(); | 69 const base::DictionaryValue* GetPref(); |
| 52 | 70 |
| 53 protected: | 71 protected: |
| 54 // Set the preference with |pref|, pass the ownership of it as well. | 72 // Set the preference with |pref|, pass the ownership of it as well. |
| 55 // This function must be called before accessing publicly exposed functions, | 73 // This function must be called before accessing publicly exposed functions, |
| 56 // for example in constructor of subclass. | 74 // for example in constructor of subclass. |
| 57 void SetPref(base::DictionaryValue* pref); | 75 void SetPref(base::DictionaryValue* pref); |
| 58 | 76 |
| 59 // Take the preference. Caller takes ownership of it as well. | 77 // Take the preference. Caller takes ownership of it as well. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 116 |
| 99 private: | 117 private: |
| 100 TestingPrefService* service_; | 118 TestingPrefService* service_; |
| 101 | 119 |
| 102 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementPrefUpdater); | 120 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementPrefUpdater); |
| 103 }; | 121 }; |
| 104 | 122 |
| 105 } // namespace extensions | 123 } // namespace extensions |
| 106 | 124 |
| 107 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_TEST_UTIL_H_ | 125 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_TEST_UTIL_H_ |
| OLD | NEW |