| 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_TEST_EXTENSION_PREFS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const ExtensionPrefs& const_prefs() const { return *prefs_.get(); } | 31 const ExtensionPrefs& const_prefs() const { return *prefs_.get(); } |
| 32 PrefService* pref_service() { return pref_service_.get(); } | 32 PrefService* pref_service() { return pref_service_.get(); } |
| 33 const FilePath& temp_dir() const { return temp_dir_.path(); } | 33 const FilePath& temp_dir() const { return temp_dir_.path(); } |
| 34 | 34 |
| 35 // This will cause the ExtensionPrefs to be deleted and recreated, based on | 35 // This will cause the ExtensionPrefs to be deleted and recreated, based on |
| 36 // any existing backing file we had previously created. | 36 // any existing backing file we had previously created. |
| 37 void RecreateExtensionPrefs(); | 37 void RecreateExtensionPrefs(); |
| 38 | 38 |
| 39 // Creates a new Extension with the given name in our temp dir, adds it to | 39 // Creates a new Extension with the given name in our temp dir, adds it to |
| 40 // our ExtensionPrefs, and returns it. | 40 // our ExtensionPrefs, and returns it. |
| 41 scoped_refptr<Extension> AddExtension(std::string name); | 41 scoped_refptr<extensions::Extension> AddExtension(std::string name); |
| 42 | 42 |
| 43 // As above, but the extension is an app. | 43 // As above, but the extension is an app. |
| 44 scoped_refptr<Extension> AddApp(std::string name); | 44 scoped_refptr<extensions::Extension> AddApp(std::string name); |
| 45 | 45 |
| 46 // Similar to AddExtension, but takes a dictionary with manifest values. | 46 // Similar to AddExtension, but takes a dictionary with manifest values. |
| 47 scoped_refptr<Extension> AddExtensionWithManifest( | 47 scoped_refptr<extensions::Extension> AddExtensionWithManifest( |
| 48 const base::DictionaryValue& manifest, Extension::Location location); | 48 const base::DictionaryValue& manifest, |
| 49 extensions::Extension::Location location); |
| 49 | 50 |
| 50 // Similar to AddExtension, but takes a dictionary with manifest values | 51 // Similar to AddExtension, but takes a dictionary with manifest values |
| 51 // and extension flags. | 52 // and extension flags. |
| 52 scoped_refptr<Extension> AddExtensionWithManifestAndFlags( | 53 scoped_refptr<extensions::Extension> AddExtensionWithManifestAndFlags( |
| 53 const base::DictionaryValue& manifest, | 54 const base::DictionaryValue& manifest, |
| 54 Extension::Location location, | 55 extensions::Extension::Location location, |
| 55 int extra_flags); | 56 int extra_flags); |
| 56 | 57 |
| 57 // Similar to AddExtension, this adds a new test Extension. This is useful for | 58 // Similar to AddExtension, this adds a new test Extension. This is useful for |
| 58 // cases when you don't need the Extension object, but just the id it was | 59 // cases when you don't need the Extension object, but just the id it was |
| 59 // assigned. | 60 // assigned. |
| 60 std::string AddExtensionAndReturnId(std::string name); | 61 std::string AddExtensionAndReturnId(std::string name); |
| 61 | 62 |
| 62 PrefService* CreateIncognitoPrefService() const; | 63 PrefService* CreateIncognitoPrefService() const; |
| 63 | 64 |
| 64 // Allows disabling the loading of preferences of extensions. Becomes | 65 // Allows disabling the loading of preferences of extensions. Becomes |
| 65 // active after calling RecreateExtensionPrefs(). Defaults to false. | 66 // active after calling RecreateExtensionPrefs(). Defaults to false. |
| 66 void set_extensions_disabled(bool extensions_disabled); | 67 void set_extensions_disabled(bool extensions_disabled); |
| 67 | 68 |
| 68 protected: | 69 protected: |
| 69 ScopedTempDir temp_dir_; | 70 ScopedTempDir temp_dir_; |
| 70 FilePath preferences_file_; | 71 FilePath preferences_file_; |
| 71 FilePath extensions_dir_; | 72 FilePath extensions_dir_; |
| 72 scoped_ptr<PrefService> pref_service_; | 73 scoped_ptr<PrefService> pref_service_; |
| 73 scoped_ptr<ExtensionPrefs> prefs_; | 74 scoped_ptr<ExtensionPrefs> prefs_; |
| 74 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | 75 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 bool extensions_disabled_; | 78 bool extensions_disabled_; |
| 78 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); | 79 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ | 82 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
| OLD | NEW |