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

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

Issue 2823037: Add an ExtensionPrefStore, layered between the user prefs nad the managed pre... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/extensions/test_extension_prefs.h" 5 #include "chrome/browser/extensions/test_extension_prefs.h"
6 6
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 24 matching lines...) Expand all
35 // The PrefService writes its persistent file on the file thread, so we 35 // The PrefService writes its persistent file on the file thread, so we
36 // need to wait for any pending I/O to complete before creating a new 36 // need to wait for any pending I/O to complete before creating a new
37 // PrefService. 37 // PrefService.
38 MessageLoop file_loop; 38 MessageLoop file_loop;
39 ChromeThread file_thread(ChromeThread::FILE, &file_loop); 39 ChromeThread file_thread(ChromeThread::FILE, &file_loop);
40 pref_service_->SavePersistentPrefs(); 40 pref_service_->SavePersistentPrefs();
41 file_loop.RunAllPending(); 41 file_loop.RunAllPending();
42 } 42 }
43 43
44 // Create a |PrefService| instance that contains only user defined values. 44 // Create a |PrefService| instance that contains only user defined values.
45 pref_service_.reset(new PrefService(new PrefValueStore( 45 pref_service_.reset(PrefService::CreateUserPrefService(preferences_file_));
46 NULL, /* no managed preference values */
47 new JsonPrefStore( /* user defined preferemnce values*/
48 preferences_file_,
49 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)),
50 NULL /* no suggested preference values*/)));
51 ExtensionPrefs::RegisterUserPrefs(pref_service_.get()); 46 ExtensionPrefs::RegisterUserPrefs(pref_service_.get());
52 prefs_.reset(new ExtensionPrefs(pref_service_.get(), temp_dir_.path())); 47 prefs_.reset(new ExtensionPrefs(pref_service_.get(), temp_dir_.path()));
53 } 48 }
54 49
55 Extension* TestExtensionPrefs::AddExtension(std::string name) { 50 Extension* TestExtensionPrefs::AddExtension(std::string name) {
56 DictionaryValue dictionary; 51 DictionaryValue dictionary;
57 dictionary.SetString(extension_manifest_keys::kName, name); 52 dictionary.SetString(extension_manifest_keys::kName, name);
58 dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); 53 dictionary.SetString(extension_manifest_keys::kVersion, "0.1");
59 return AddExtensionWithManifest(dictionary); 54 return AddExtensionWithManifest(dictionary);
60 } 55 }
(...skipping 11 matching lines...) Expand all
72 const bool kInitialIncognitoEnabled = false; 67 const bool kInitialIncognitoEnabled = false;
73 prefs_->OnExtensionInstalled(extension, Extension::ENABLED, 68 prefs_->OnExtensionInstalled(extension, Extension::ENABLED,
74 kInitialIncognitoEnabled); 69 kInitialIncognitoEnabled);
75 return extension; 70 return extension;
76 } 71 }
77 72
78 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { 73 std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) {
79 scoped_ptr<Extension> extension(AddExtension(name)); 74 scoped_ptr<Extension> extension(AddExtension(name));
80 return extension->id(); 75 return extension->id();
81 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service_unittest.cc ('k') | chrome/browser/managed_prefs_banner_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698