Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: chrome/browser/extensions/test_extension_prefs.h

Issue 14622003: components: Move PrefRegistrySyncable into user_prefs namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/common/extensions/manifest.h" 13 #include "chrome/common/extensions/manifest.h"
14 14
15 class ExtensionPrefValueMap; 15 class ExtensionPrefValueMap;
16 class PrefRegistrySyncable;
17 class PrefService; 16 class PrefService;
18 class PrefServiceSyncable; 17 class PrefServiceSyncable;
19 18
20 namespace base { 19 namespace base {
21 class DictionaryValue; 20 class DictionaryValue;
22 class SequencedTaskRunner; 21 class SequencedTaskRunner;
23 } 22 }
24 23
24 namespace user_prefs {
25 class PrefRegistrySyncable;
26 }
27
25 namespace extensions { 28 namespace extensions {
26 class Extension; 29 class Extension;
27 class ExtensionPrefs; 30 class ExtensionPrefs;
28 31
29 // This is a test class intended to make it easier to work with ExtensionPrefs 32 // This is a test class intended to make it easier to work with ExtensionPrefs
30 // in tests. 33 // in tests.
31 class TestExtensionPrefs { 34 class TestExtensionPrefs {
32 public: 35 public:
33 explicit TestExtensionPrefs(base::SequencedTaskRunner* task_runner); 36 explicit TestExtensionPrefs(base::SequencedTaskRunner* task_runner);
34 virtual ~TestExtensionPrefs(); 37 virtual ~TestExtensionPrefs();
35 38
36 ExtensionPrefs* prefs() { return prefs_.get(); } 39 ExtensionPrefs* prefs() { return prefs_.get(); }
37 const ExtensionPrefs& const_prefs() const { 40 const ExtensionPrefs& const_prefs() const {
38 return *prefs_.get(); 41 return *prefs_.get();
39 } 42 }
40 PrefService* pref_service(); 43 PrefService* pref_service();
41 const scoped_refptr<PrefRegistrySyncable>& pref_registry(); 44 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry();
42 void ResetPrefRegistry(); 45 void ResetPrefRegistry();
43 const base::FilePath& temp_dir() const { return temp_dir_.path(); } 46 const base::FilePath& temp_dir() const { return temp_dir_.path(); }
44 const base::FilePath& extensions_dir() const { return extensions_dir_; } 47 const base::FilePath& extensions_dir() const { return extensions_dir_; }
45 48
46 // This will cause the ExtensionPrefs to be deleted and recreated, based on 49 // This will cause the ExtensionPrefs to be deleted and recreated, based on
47 // any existing backing file we had previously created. 50 // any existing backing file we had previously created.
48 void RecreateExtensionPrefs(); 51 void RecreateExtensionPrefs();
49 52
50 // Creates a new Extension with the given name in our temp dir, adds it to 53 // Creates a new Extension with the given name in our temp dir, adds it to
51 // our ExtensionPrefs, and returns it. 54 // our ExtensionPrefs, and returns it.
(...skipping 22 matching lines...) Expand all
74 PrefService* CreateIncognitoPrefService() const; 77 PrefService* CreateIncognitoPrefService() const;
75 78
76 // Allows disabling the loading of preferences of extensions. Becomes 79 // Allows disabling the loading of preferences of extensions. Becomes
77 // active after calling RecreateExtensionPrefs(). Defaults to false. 80 // active after calling RecreateExtensionPrefs(). Defaults to false.
78 void set_extensions_disabled(bool extensions_disabled); 81 void set_extensions_disabled(bool extensions_disabled);
79 82
80 protected: 83 protected:
81 base::ScopedTempDir temp_dir_; 84 base::ScopedTempDir temp_dir_;
82 base::FilePath preferences_file_; 85 base::FilePath preferences_file_;
83 base::FilePath extensions_dir_; 86 base::FilePath extensions_dir_;
84 scoped_refptr<PrefRegistrySyncable> pref_registry_; 87 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_;
85 scoped_ptr<PrefServiceSyncable> pref_service_; 88 scoped_ptr<PrefServiceSyncable> pref_service_;
86 scoped_ptr<ExtensionPrefs> prefs_; 89 scoped_ptr<ExtensionPrefs> prefs_;
87 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; 90 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
88 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 91 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
89 92
90 private: 93 private:
91 bool extensions_disabled_; 94 bool extensions_disabled_;
92 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); 95 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs);
93 }; 96 };
94 97
95 } // namespace extensions 98 } // namespace extensions
96 99
97 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ 100 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_browsertest.cc ('k') | chrome/browser/extensions/test_extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698