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 #include "chrome/browser/extensions/test_extension_system.h" | 5 #include "chrome/browser/extensions/test_extension_system.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/extensions/blacklist.h" | 9 #include "chrome/browser/extensions/blacklist.h" |
10 #include "chrome/browser/extensions/extension_management.h" | 10 #include "chrome/browser/extensions/extension_management.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 command_line && command_line->HasSwitch(switches::kDisableExtensions); | 51 command_line && command_line->HasSwitch(switches::kDisableExtensions); |
52 | 52 |
53 // Note that the GetPrefs() creates a TestingPrefService, therefore | 53 // Note that the GetPrefs() creates a TestingPrefService, therefore |
54 // the extension controlled pref values set in ExtensionPrefs | 54 // the extension controlled pref values set in ExtensionPrefs |
55 // are not reflected in the pref service. One would need to | 55 // are not reflected in the pref service. One would need to |
56 // inject a new ExtensionPrefStore(extension_pref_value_map, false). | 56 // inject a new ExtensionPrefStore(extension_pref_value_map, false). |
57 | 57 |
58 return make_scoped_ptr(ExtensionPrefs::Create( | 58 return make_scoped_ptr(ExtensionPrefs::Create( |
59 profile_->GetPrefs(), install_directory, | 59 profile_->GetPrefs(), install_directory, |
60 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_), | 60 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_), |
61 ExtensionsBrowserClient::Get()->CreateAppSorting(profile_).Pass(), | |
62 extensions_disabled, std::vector<ExtensionPrefsObserver*>())); | 61 extensions_disabled, std::vector<ExtensionPrefsObserver*>())); |
63 } | 62 } |
64 | 63 |
65 ExtensionService* TestExtensionSystem::CreateExtensionService( | 64 ExtensionService* TestExtensionSystem::CreateExtensionService( |
66 const base::CommandLine* command_line, | 65 const base::CommandLine* command_line, |
67 const base::FilePath& install_directory, | 66 const base::FilePath& install_directory, |
68 bool autoupdate_enabled) { | 67 bool autoupdate_enabled) { |
69 // The ownership of |value_store_| is immediately transferred to state_store_, | 68 // The ownership of |value_store_| is immediately transferred to state_store_, |
70 // but we keep a naked pointer to the TestingValueStore. | 69 // but we keep a naked pointer to the TestingValueStore. |
71 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); | 70 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 StateStore* TestExtensionSystem::rules_store() { | 114 StateStore* TestExtensionSystem::rules_store() { |
116 return state_store_.get(); | 115 return state_store_.get(); |
117 } | 116 } |
118 | 117 |
119 InfoMap* TestExtensionSystem::info_map() { return info_map_.get(); } | 118 InfoMap* TestExtensionSystem::info_map() { return info_map_.get(); } |
120 | 119 |
121 QuotaService* TestExtensionSystem::quota_service() { | 120 QuotaService* TestExtensionSystem::quota_service() { |
122 return quota_service_.get(); | 121 return quota_service_.get(); |
123 } | 122 } |
124 | 123 |
| 124 AppSorting* TestExtensionSystem::app_sorting() { |
| 125 return nullptr; |
| 126 } |
| 127 |
125 const OneShotEvent& TestExtensionSystem::ready() const { | 128 const OneShotEvent& TestExtensionSystem::ready() const { |
126 return ready_; | 129 return ready_; |
127 } | 130 } |
128 | 131 |
129 ContentVerifier* TestExtensionSystem::content_verifier() { | 132 ContentVerifier* TestExtensionSystem::content_verifier() { |
130 return NULL; | 133 return NULL; |
131 } | 134 } |
132 | 135 |
133 scoped_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions( | 136 scoped_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions( |
134 const Extension* extension) { | 137 const Extension* extension) { |
135 return extension_service()->shared_module_service()->GetDependentExtensions( | 138 return extension_service()->shared_module_service()->GetDependentExtensions( |
136 extension); | 139 extension); |
137 } | 140 } |
138 | 141 |
139 // static | 142 // static |
140 scoped_ptr<KeyedService> TestExtensionSystem::Build( | 143 scoped_ptr<KeyedService> TestExtensionSystem::Build( |
141 content::BrowserContext* profile) { | 144 content::BrowserContext* profile) { |
142 return make_scoped_ptr( | 145 return make_scoped_ptr( |
143 new TestExtensionSystem(static_cast<Profile*>(profile))); | 146 new TestExtensionSystem(static_cast<Profile*>(profile))); |
144 } | 147 } |
145 | 148 |
146 } // namespace extensions | 149 } // namespace extensions |
OLD | NEW |