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

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

Issue 500043003: Add PolicyProvider to ExtensionManagement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-1
Patch Set: fixes to #5 Created 6 years, 3 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
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 #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/declarative_user_script_master.h" 10 #include "chrome/browser/extensions/declarative_user_script_master.h"
11 #include "chrome/browser/extensions/error_console/error_console.h" 11 #include "chrome/browser/extensions/error_console/error_console.h"
12 #include "chrome/browser/extensions/extension_management.h"
12 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/install_verifier.h" 14 #include "chrome/browser/extensions/install_verifier.h"
14 #include "chrome/browser/extensions/shared_module_service.h" 15 #include "chrome/browser/extensions/shared_module_service.h"
15 #include "chrome/browser/extensions/standard_management_policy_provider.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "extensions/browser/event_router.h" 19 #include "extensions/browser/event_router.h"
20 #include "extensions/browser/extension_pref_value_map.h" 20 #include "extensions/browser/extension_pref_value_map.h"
21 #include "extensions/browser/extension_pref_value_map_factory.h" 21 #include "extensions/browser/extension_pref_value_map_factory.h"
22 #include "extensions/browser/extension_prefs.h" 22 #include "extensions/browser/extension_prefs.h"
23 #include "extensions/browser/extension_prefs_factory.h" 23 #include "extensions/browser/extension_prefs_factory.h"
24 #include "extensions/browser/extension_registry.h" 24 #include "extensions/browser/extension_registry.h"
25 #include "extensions/browser/extension_system.h" 25 #include "extensions/browser/extension_system.h"
(...skipping 14 matching lines...) Expand all
40 : profile_(profile), 40 : profile_(profile),
41 value_store_(NULL), 41 value_store_(NULL),
42 info_map_(new InfoMap()), 42 info_map_(new InfoMap()),
43 error_console_(new ErrorConsole(profile)), 43 error_console_(new ErrorConsole(profile)),
44 quota_service_(new QuotaService()) {} 44 quota_service_(new QuotaService()) {}
45 45
46 TestExtensionSystem::~TestExtensionSystem() { 46 TestExtensionSystem::~TestExtensionSystem() {
47 } 47 }
48 48
49 void TestExtensionSystem::Shutdown() { 49 void TestExtensionSystem::Shutdown() {
50 if (extension_service_)
51 extension_service_->Shutdown();
50 process_manager_.reset(); 52 process_manager_.reset();
51 } 53 }
52 54
53 void TestExtensionSystem::CreateProcessManager() { 55 void TestExtensionSystem::CreateProcessManager() {
54 process_manager_.reset(ProcessManager::Create(profile_)); 56 process_manager_.reset(ProcessManager::Create(profile_));
55 } 57 }
56 58
57 void TestExtensionSystem::SetProcessManager(ProcessManager* manager) { 59 void TestExtensionSystem::SetProcessManager(ProcessManager* manager) {
58 process_manager_.reset(manager); 60 process_manager_.reset(manager);
59 } 61 }
(...skipping 30 matching lines...) Expand all
90 CreateExtensionPrefs(command_line, install_directory); 92 CreateExtensionPrefs(command_line, install_directory);
91 install_verifier_.reset( 93 install_verifier_.reset(
92 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_)); 94 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_));
93 // The ownership of |value_store_| is immediately transferred to state_store_, 95 // The ownership of |value_store_| is immediately transferred to state_store_,
94 // but we keep a naked pointer to the TestingValueStore. 96 // but we keep a naked pointer to the TestingValueStore.
95 scoped_ptr<TestingValueStore> value_store(new TestingValueStore()); 97 scoped_ptr<TestingValueStore> value_store(new TestingValueStore());
96 value_store_ = value_store.get(); 98 value_store_ = value_store.get();
97 state_store_.reset( 99 state_store_.reset(
98 new StateStore(profile_, value_store.PassAs<ValueStore>())); 100 new StateStore(profile_, value_store.PassAs<ValueStore>()));
99 blacklist_.reset(new Blacklist(ExtensionPrefs::Get(profile_))); 101 blacklist_.reset(new Blacklist(ExtensionPrefs::Get(profile_)));
100 standard_management_policy_provider_.reset(
101 new StandardManagementPolicyProvider(ExtensionPrefs::Get(profile_)));
102 management_policy_.reset(new ManagementPolicy()); 102 management_policy_.reset(new ManagementPolicy());
103 management_policy_->RegisterProvider( 103 management_policy_->RegisterProvider(
104 standard_management_policy_provider_.get()); 104 ExtensionManagementFactory::GetForBrowserContext(profile_)
105 ->GetProvider());
105 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); 106 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_)));
106 extension_service_.reset(new ExtensionService(profile_, 107 extension_service_.reset(new ExtensionService(profile_,
107 command_line, 108 command_line,
108 install_directory, 109 install_directory,
109 ExtensionPrefs::Get(profile_), 110 ExtensionPrefs::Get(profile_),
110 blacklist_.get(), 111 blacklist_.get(),
111 autoupdate_enabled, 112 autoupdate_enabled,
112 true, 113 true,
113 &ready_)); 114 &ready_));
114 extension_service_->ClearProvidersForTesting(); 115 extension_service_->ClearProvidersForTesting();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 215 }
215 return master; 216 return master;
216 } 217 }
217 218
218 // static 219 // static
219 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) { 220 KeyedService* TestExtensionSystem::Build(content::BrowserContext* profile) {
220 return new TestExtensionSystem(static_cast<Profile*>(profile)); 221 return new TestExtensionSystem(static_cast<Profile*>(profile));
221 } 222 }
222 223
223 } // namespace extensions 224 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698