blob: bd3b0ba9908491a66a80bafcc5883987d930f251 [file] [log] [blame]
[email protected]31d8f5f22012-04-02 15:22:081// 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
3// found in the LICENSE file.
4
5#include "chrome/browser/extensions/extension_system.h"
6
[email protected]53603d22012-11-14 08:31:117#include "base/base_switches.h"
[email protected]31d8f5f22012-04-02 15:22:088#include "base/bind.h"
9#include "base/command_line.h"
[email protected]57999812013-02-24 05:40:5210#include "base/files/file_path.h"
[email protected]3853a4c2013-02-11 17:15:5711#include "base/prefs/pref_service.h"
[email protected]f4ebe772013-02-02 00:21:3912#include "base/strings/string_tokenizer.h"
[email protected]31d8f5f22012-04-02 15:22:0813#include "chrome/browser/browser_process.h"
[email protected]31d8f5f22012-04-02 15:22:0814#include "chrome/browser/content_settings/cookie_settings.h"
[email protected]ca6df682012-04-10 23:00:2015#include "chrome/browser/extensions/api/alarms/alarm_manager.h"
[email protected]b813ed72012-04-05 08:21:3616#include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
[email protected]938da062012-10-18 21:18:1617#include "chrome/browser/extensions/api/messaging/message_service.h"
[email protected]fdd679b2012-11-15 20:49:3918#include "chrome/browser/extensions/blacklist.h"
[email protected]931186e02012-07-20 01:22:0619#include "chrome/browser/extensions/component_loader.h"
[email protected]5a38dfd2012-07-23 23:22:1020#include "chrome/browser/extensions/event_router.h"
[email protected]31d8f5f22012-04-02 15:22:0821#include "chrome/browser/extensions/extension_error_reporter.h"
[email protected]31d8f5f22012-04-02 15:22:0822#include "chrome/browser/extensions/extension_info_map.h"
[email protected]31d8f5f22012-04-02 15:22:0823#include "chrome/browser/extensions/extension_pref_store.h"
24#include "chrome/browser/extensions/extension_pref_value_map.h"
[email protected]ef9bba12012-04-06 16:26:0925#include "chrome/browser/extensions/extension_pref_value_map_factory.h"
[email protected]31d8f5f22012-04-02 15:22:0826#include "chrome/browser/extensions/extension_process_manager.h"
27#include "chrome/browser/extensions/extension_service.h"
28#include "chrome/browser/extensions/extension_system_factory.h"
[email protected]b4d3771d2012-11-14 14:44:1029#include "chrome/browser/extensions/extension_warning_badge_service.h"
30#include "chrome/browser/extensions/extension_warning_set.h"
[email protected]31d8f5f22012-04-02 15:22:0831#include "chrome/browser/extensions/lazy_background_task_queue.h"
[email protected]65187152012-06-02 13:14:1432#include "chrome/browser/extensions/management_policy.h"
[email protected]d9ede582012-08-14 19:21:3833#include "chrome/browser/extensions/navigation_observer.h"
[email protected]cb610dc2012-08-31 17:16:5634#include "chrome/browser/extensions/shell_window_geometry_cache.h"
[email protected]fdd679b2012-11-15 20:49:3935#include "chrome/browser/extensions/standard_management_policy_provider.h"
[email protected]90e800c2012-06-12 23:11:0036#include "chrome/browser/extensions/state_store.h"
[email protected]31d8f5f22012-04-02 15:22:0837#include "chrome/browser/extensions/unpacked_installer.h"
38#include "chrome/browser/extensions/user_script_master.h"
39#include "chrome/browser/profiles/profile.h"
40#include "chrome/browser/profiles/profile_manager.h"
[email protected]31d8f5f22012-04-02 15:22:0841#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
42#include "chrome/common/chrome_switches.h"
[email protected]d69d7b172012-08-09 04:17:2643#include "chrome/common/chrome_version_info.h"
[email protected]31d8f5f22012-04-02 15:22:0844#include "chrome/common/extensions/extension.h"
[email protected]5115ccc2012-06-11 19:47:0745#include "chrome/common/extensions/features/feature.h"
[email protected]1d5e58b2013-01-31 08:41:4046#include "chrome/common/extensions/manifest.h"
[email protected]31d8f5f22012-04-02 15:22:0847#include "chrome/common/pref_names.h"
48#include "content/public/browser/browser_thread.h"
[email protected]24ea7a12013-01-27 23:54:5349#include "content/public/browser/url_data_source.h"
[email protected]31d8f5f22012-04-02 15:22:0850
[email protected]bb121482012-12-08 06:49:3851#if defined(OS_CHROMEOS)
[email protected]6ed2e0c2013-04-09 04:48:1352#include "chrome/browser/app_mode/app_mode_utils.h"
[email protected]df235b32013-04-11 20:00:4553#include "chrome/browser/chromeos/login/user_manager.h"
[email protected]931d1042013-04-05 17:50:4454#include "chromeos/chromeos_switches.h"
[email protected]bb121482012-12-08 06:49:3855#endif
56
[email protected]31d8f5f22012-04-02 15:22:0857using content::BrowserThread;
58
[email protected]bd306722012-07-11 20:43:5959namespace extensions {
60
[email protected]31d8f5f22012-04-02 15:22:0861//
62// ExtensionSystem
63//
64
65ExtensionSystem::ExtensionSystem() {
[email protected]d57a089c2012-08-16 00:26:4366 // Only set if it hasn't already been set (e.g. by a test).
67 if (Feature::GetCurrentChannel() == Feature::GetDefaultChannel())
68 Feature::SetCurrentChannel(chrome::VersionInfo::GetChannel());
[email protected]31d8f5f22012-04-02 15:22:0869}
70
71ExtensionSystem::~ExtensionSystem() {
72}
73
[email protected]749d59a2012-04-05 00:23:2474// static
75ExtensionSystem* ExtensionSystem::Get(Profile* profile) {
76 return ExtensionSystemFactory::GetForProfile(profile);
77}
78
[email protected]31d8f5f22012-04-02 15:22:0879//
80// ExtensionSystemImpl::Shared
81//
82
83ExtensionSystemImpl::Shared::Shared(Profile* profile)
84 : profile_(profile) {
85}
86
87ExtensionSystemImpl::Shared::~Shared() {
88}
89
90void ExtensionSystemImpl::Shared::InitPrefs() {
91 bool extensions_disabled =
92 profile_->GetPrefs()->GetBoolean(prefs::kDisableExtensions) ||
93 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions);
[email protected]fdd679b2012-11-15 20:49:3994 extension_prefs_ = ExtensionPrefs::Create(
[email protected]31d8f5f22012-04-02 15:22:0895 profile_->GetPrefs(),
96 profile_->GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
[email protected]fdd679b2012-11-15 20:49:3997 ExtensionPrefValueMapFactory::GetForProfile(profile_),
98 extensions_disabled);
[email protected]c4dc5cc2012-11-09 08:48:3999 lazy_background_task_queue_.reset(new LazyBackgroundTaskQueue(profile_));
100 event_router_.reset(new EventRouter(profile_, extension_prefs_.get()));
[email protected]90e800c2012-06-12 23:11:00101
[email protected]a690e292012-12-19 19:22:49102 // Two state stores. The latter, which contains declarative rules, must be
103 // loaded immediately so that the rules are ready before we issue network
104 // requests.
[email protected]bd306722012-07-11 20:43:59105 state_store_.reset(new StateStore(
[email protected]90e800c2012-06-12 23:11:00106 profile_,
[email protected]a690e292012-12-19 19:22:49107 profile_->GetPath().AppendASCII(ExtensionService::kStateStoreName),
108 true));
109 rules_store_.reset(new StateStore(
110 profile_,
111 profile_->GetPath().AppendASCII(ExtensionService::kRulesStoreName),
112 false));
[email protected]cb610dc2012-08-31 17:16:56113
114 shell_window_geometry_cache_.reset(new ShellWindowGeometryCache(
[email protected]af3920f2012-12-13 00:49:24115 profile_, extension_prefs_.get()));
[email protected]fdd679b2012-11-15 20:49:39116
117 blacklist_.reset(new Blacklist(extension_prefs_.get()));
118
119 standard_management_policy_provider_.reset(
[email protected]695b5712012-12-06 23:55:28120 new StandardManagementPolicyProvider(extension_prefs_.get()));
[email protected]31d8f5f22012-04-02 15:22:08121}
122
[email protected]65187152012-06-02 13:14:14123void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() {
[email protected]fdd679b2012-11-15 20:49:39124 DCHECK(standard_management_policy_provider_.get());
125 management_policy_->RegisterProvider(
126 standard_management_policy_provider_.get());
[email protected]65187152012-06-02 13:14:14127}
128
[email protected]31d8f5f22012-04-02 15:22:08129void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
130 const CommandLine* command_line = CommandLine::ForCurrentProcess();
131
[email protected]40404bc2012-07-25 17:40:49132 message_service_.reset(new MessageService(lazy_background_task_queue_.get()));
[email protected]d9ede582012-08-14 19:21:38133 navigation_observer_.reset(new NavigationObserver(profile_));
[email protected]31d8f5f22012-04-02 15:22:08134
[email protected]53603d22012-11-14 08:31:11135 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs);
136 ExtensionErrorReporter::Init(allow_noisy_errors);
[email protected]31d8f5f22012-04-02 15:22:08137
138 user_script_master_ = new UserScriptMaster(profile_);
139
140 bool autoupdate_enabled = true;
141#if defined(OS_CHROMEOS)
142 if (!extensions_enabled)
143 autoupdate_enabled = false;
144 else
[email protected]931d1042013-04-05 17:50:44145 autoupdate_enabled =
146 !command_line->HasSwitch(chromeos::switches::kGuestSession);
[email protected]31d8f5f22012-04-02 15:22:08147#endif
148 extension_service_.reset(new ExtensionService(
149 profile_,
150 CommandLine::ForCurrentProcess(),
151 profile_->GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
152 extension_prefs_.get(),
[email protected]fdd679b2012-11-15 20:49:39153 blacklist_.get(),
[email protected]31d8f5f22012-04-02 15:22:08154 autoupdate_enabled,
155 extensions_enabled));
156
[email protected]d7fbc092012-06-18 22:52:00157 // These services must be registered before the ExtensionService tries to
158 // load any extensions.
159 {
[email protected]bd306722012-07-11 20:43:59160 management_policy_.reset(new ManagementPolicy);
[email protected]d7fbc092012-06-18 22:52:00161 RegisterManagementPolicyProviders();
162 }
[email protected]65187152012-06-02 13:14:14163
[email protected]bb121482012-12-08 06:49:38164 bool skip_session_extensions = false;
165#if defined(OS_CHROMEOS)
166 // Skip loading session extensions if we are not in a user session.
[email protected]df235b32013-04-11 20:00:45167 skip_session_extensions = !chromeos::UserManager::Get()->IsUserLoggedIn();
[email protected]6ed2e0c2013-04-09 04:48:13168 if (!chrome::IsRunningInForcedAppMode()) {
169 extension_service_->component_loader()->AddDefaultComponentExtensions(
170 skip_session_extensions);
171 }
172#else
[email protected]bb121482012-12-08 06:49:38173 extension_service_->component_loader()->AddDefaultComponentExtensions(
174 skip_session_extensions);
[email protected]6ed2e0c2013-04-09 04:48:13175#endif
[email protected]31d8f5f22012-04-02 15:22:08176 if (command_line->HasSwitch(switches::kLoadComponentExtension)) {
177 CommandLine::StringType path_list = command_line->GetSwitchValueNative(
178 switches::kLoadComponentExtension);
[email protected]f4ebe772013-02-02 00:21:39179 base::StringTokenizerT<CommandLine::StringType,
[email protected]31d8f5f22012-04-02 15:22:08180 CommandLine::StringType::const_iterator> t(path_list,
181 FILE_PATH_LITERAL(","));
182 while (t.GetNext()) {
183 // Load the component extension manifest synchronously.
184 // Blocking the UI thread is acceptable here since
185 // this flag designated for developers.
186 base::ThreadRestrictions::ScopedAllowIO allow_io;
187 extension_service_->component_loader()->AddOrReplace(
[email protected]650b2d52013-02-10 03:41:45188 base::FilePath(t.token()));
[email protected]31d8f5f22012-04-02 15:22:08189 }
190 }
191 extension_service_->Init();
192
193 if (extensions_enabled) {
194 // Load any extensions specified with --load-extension.
195 // TODO(yoz): Seems like this should move into ExtensionService::Init.
196 // But maybe it's no longer important.
197 if (command_line->HasSwitch(switches::kLoadExtension)) {
198 CommandLine::StringType path_list = command_line->GetSwitchValueNative(
199 switches::kLoadExtension);
[email protected]f4ebe772013-02-02 00:21:39200 base::StringTokenizerT<CommandLine::StringType,
[email protected]31d8f5f22012-04-02 15:22:08201 CommandLine::StringType::const_iterator> t(path_list,
202 FILE_PATH_LITERAL(","));
[email protected]31d8f5f22012-04-02 15:22:08203 while (t.GetNext()) {
[email protected]98270432012-09-11 20:51:24204 UnpackedInstaller::Create(extension_service_.get())->
[email protected]9d02fa12013-02-19 05:12:57205 LoadFromCommandLine(base::FilePath(t.token()), false);
[email protected]31d8f5f22012-04-02 15:22:08206 }
207 }
208 }
209
210 // Make the chrome://extension-icon/ resource available.
[email protected]24ea7a12013-01-27 23:54:53211 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_));
[email protected]31d8f5f22012-04-02 15:22:08212
213 // Initialize extension event routers. Note that on Chrome OS, this will
214 // not succeed if the user has not logged in yet, in which case the
215 // event routers are initialized in LoginUtilsImpl::CompleteLogin instead.
216 // The InitEventRouters call used to be in BrowserMain, because when bookmark
217 // import happened on first run, the bookmark bar was not being correctly
218 // initialized (see issue 40144). Now that bookmarks aren't imported and
219 // the event routers need to be initialized for every profile individually,
220 // initialize them with the extension service.
[email protected]ae4c37e2012-12-21 01:16:25221 // If import is going to run in a separate process (the profile itself is on
222 // the main process), wait for import to finish before initializing the
223 // routers.
224 CHECK(!ProfileManager::IsImportProcess(*command_line));
225 if (g_browser_process->profile_manager()->will_import()) {
226 extension_service_->InitEventRoutersAfterImport();
227 } else {
228 extension_service_->InitEventRouters();
[email protected]31d8f5f22012-04-02 15:22:08229 }
[email protected]2def34cd2012-12-08 07:07:54230
231 extension_warning_service_.reset(new ExtensionWarningService(profile_));
232 extension_warning_badge_service_.reset(
233 new ExtensionWarningBadgeService(profile_));
234 extension_warning_service_->AddObserver(
235 extension_warning_badge_service_.get());
[email protected]31d8f5f22012-04-02 15:22:08236}
237
[email protected]47b896562012-08-22 23:55:15238void ExtensionSystemImpl::Shared::Shutdown() {
[email protected]3eeddd892013-04-17 17:00:11239 if (extension_warning_service_) {
[email protected]2def34cd2012-12-08 07:07:54240 extension_warning_service_->RemoveObserver(
241 extension_warning_badge_service_.get());
242 }
[email protected]3eeddd892013-04-17 17:00:11243 if (extension_service_)
[email protected]47b896562012-08-22 23:55:15244 extension_service_->Shutdown();
245}
246
[email protected]014eb202013-02-26 01:51:17247base::Clock* ExtensionSystemImpl::Shared::clock() {
248 return &clock_;
249}
250
[email protected]bd306722012-07-11 20:43:59251StateStore* ExtensionSystemImpl::Shared::state_store() {
[email protected]90e800c2012-06-12 23:11:00252 return state_store_.get();
253}
254
[email protected]a690e292012-12-19 19:22:49255StateStore* ExtensionSystemImpl::Shared::rules_store() {
256 return rules_store_.get();
257}
258
[email protected]e21bdfb2013-01-15 08:32:32259ExtensionPrefs* ExtensionSystemImpl::Shared::extension_prefs() {
260 return extension_prefs_.get();
261}
262
[email protected]cb610dc2012-08-31 17:16:56263ShellWindowGeometryCache* ExtensionSystemImpl::Shared::
264 shell_window_geometry_cache() {
265 return shell_window_geometry_cache_.get();
266}
267
[email protected]31d8f5f22012-04-02 15:22:08268ExtensionService* ExtensionSystemImpl::Shared::extension_service() {
269 return extension_service_.get();
270}
271
[email protected]bd306722012-07-11 20:43:59272ManagementPolicy* ExtensionSystemImpl::Shared::management_policy() {
[email protected]65187152012-06-02 13:14:14273 return management_policy_.get();
274}
275
[email protected]31d8f5f22012-04-02 15:22:08276UserScriptMaster* ExtensionSystemImpl::Shared::user_script_master() {
277 return user_script_master_.get();
278}
279
280ExtensionInfoMap* ExtensionSystemImpl::Shared::info_map() {
[email protected]9656bc52012-08-13 17:05:33281 if (!extension_info_map_)
282 extension_info_map_ = new ExtensionInfoMap();
[email protected]31d8f5f22012-04-02 15:22:08283 return extension_info_map_.get();
284}
285
[email protected]bd306722012-07-11 20:43:59286LazyBackgroundTaskQueue*
287 ExtensionSystemImpl::Shared::lazy_background_task_queue() {
[email protected]31d8f5f22012-04-02 15:22:08288 return lazy_background_task_queue_.get();
289}
290
[email protected]40404bc2012-07-25 17:40:49291MessageService* ExtensionSystemImpl::Shared::message_service() {
292 return message_service_.get();
[email protected]31d8f5f22012-04-02 15:22:08293}
294
[email protected]5a38dfd2012-07-23 23:22:10295EventRouter* ExtensionSystemImpl::Shared::event_router() {
[email protected]c4dc5cc2012-11-09 08:48:39296 return event_router_.get();
[email protected]31d8f5f22012-04-02 15:22:08297}
298
[email protected]2def34cd2012-12-08 07:07:54299ExtensionWarningService* ExtensionSystemImpl::Shared::warning_service() {
300 return extension_warning_service_.get();
301}
302
[email protected]fdd679b2012-11-15 20:49:39303Blacklist* ExtensionSystemImpl::Shared::blacklist() {
304 return blacklist_.get();
305}
306
[email protected]31d8f5f22012-04-02 15:22:08307//
308// ExtensionSystemImpl
309//
310
311ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile)
[email protected]98b673032012-12-11 10:26:02312 : profile_(profile) {
[email protected]31d8f5f22012-04-02 15:22:08313 shared_ = ExtensionSystemSharedFactory::GetForProfile(profile);
314
315 if (profile->IsOffTheRecord()) {
316 extension_process_manager_.reset(ExtensionProcessManager::Create(profile));
317 } else {
318 shared_->InitPrefs();
319 }
320}
321
322ExtensionSystemImpl::~ExtensionSystemImpl() {
[email protected]3eeddd892013-04-17 17:00:11323 if (rules_registry_service_)
[email protected]3dfa4c02012-07-30 17:21:41324 rules_registry_service_->Shutdown();
[email protected]31d8f5f22012-04-02 15:22:08325}
326
327void ExtensionSystemImpl::Shutdown() {
328 extension_process_manager_.reset();
[email protected]f12a60ed2013-03-08 20:29:53329
330 if (profile_->IsOffTheRecord() && extension_service() &&
331 extension_service()->extensions_enabled())
332 extension_prefs()->ClearIncognitoSessionOnlyContentSettings();
[email protected]31d8f5f22012-04-02 15:22:08333}
334
[email protected]3dfa4c02012-07-30 17:21:41335void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) {
[email protected]31d8f5f22012-04-02 15:22:08336 DCHECK(!profile_->IsOffTheRecord());
337 if (user_script_master() || extension_service())
338 return; // Already initialized.
339
[email protected]9656bc52012-08-13 17:05:33340 // The ExtensionInfoMap needs to be created before the
341 // ExtensionProcessManager.
342 shared_->info_map();
[email protected]31d8f5f22012-04-02 15:22:08343
344 extension_process_manager_.reset(ExtensionProcessManager::Create(profile_));
[email protected]014eb202013-02-26 01:51:17345 alarm_manager_.reset(new AlarmManager(profile_, shared_->clock()));
[email protected]931186e02012-07-20 01:22:06346
347 serial_connection_manager_.reset(new ApiResourceManager<SerialConnection>(
348 BrowserThread::FILE));
349 socket_manager_.reset(new ApiResourceManager<Socket>(BrowserThread::IO));
350 usb_device_resource_manager_.reset(
351 new ApiResourceManager<UsbDeviceResource>(BrowserThread::IO));
[email protected]31d8f5f22012-04-02 15:22:08352
[email protected]3dfa4c02012-07-30 17:21:41353 rules_registry_service_.reset(new RulesRegistryService(profile_));
354 rules_registry_service_->RegisterDefaultRulesRegistries();
355
[email protected]31d8f5f22012-04-02 15:22:08356 shared_->Init(extensions_enabled);
357}
358
[email protected]3dfa4c02012-07-30 17:21:41359void ExtensionSystemImpl::InitForOTRProfile() {
360 // Only initialize the RulesRegistryService of the OTR ExtensionSystem if the
361 // regular ExtensionSystem has been initialized properly, as we depend on it.
362 // Some ChromeOS browser tests don't initialize the regular ExtensionSystem
363 // in login-tests.
364 if (extension_service()) {
365 rules_registry_service_.reset(new RulesRegistryService(profile_));
366 rules_registry_service_->RegisterDefaultRulesRegistries();
367 }
368}
369
[email protected]31d8f5f22012-04-02 15:22:08370ExtensionService* ExtensionSystemImpl::extension_service() {
371 return shared_->extension_service();
372}
373
[email protected]bd306722012-07-11 20:43:59374ManagementPolicy* ExtensionSystemImpl::management_policy() {
[email protected]65187152012-06-02 13:14:14375 return shared_->management_policy();
376}
377
[email protected]31d8f5f22012-04-02 15:22:08378UserScriptMaster* ExtensionSystemImpl::user_script_master() {
379 return shared_->user_script_master();
380}
381
[email protected]31d8f5f22012-04-02 15:22:08382ExtensionProcessManager* ExtensionSystemImpl::process_manager() {
383 return extension_process_manager_.get();
384}
385
[email protected]bd306722012-07-11 20:43:59386AlarmManager* ExtensionSystemImpl::alarm_manager() {
[email protected]ca6df682012-04-10 23:00:20387 return alarm_manager_.get();
388}
389
[email protected]bd306722012-07-11 20:43:59390StateStore* ExtensionSystemImpl::state_store() {
[email protected]90e800c2012-06-12 23:11:00391 return shared_->state_store();
392}
393
[email protected]a690e292012-12-19 19:22:49394StateStore* ExtensionSystemImpl::rules_store() {
395 return shared_->rules_store();
396}
397
[email protected]e21bdfb2013-01-15 08:32:32398ExtensionPrefs* ExtensionSystemImpl::extension_prefs() {
399 return shared_->extension_prefs();
400}
401
[email protected]cb610dc2012-08-31 17:16:56402ShellWindowGeometryCache* ExtensionSystemImpl::shell_window_geometry_cache() {
403 return shared_->shell_window_geometry_cache();
404}
405
[email protected]31d8f5f22012-04-02 15:22:08406ExtensionInfoMap* ExtensionSystemImpl::info_map() {
407 return shared_->info_map();
408}
409
[email protected]bd306722012-07-11 20:43:59410LazyBackgroundTaskQueue* ExtensionSystemImpl::lazy_background_task_queue() {
[email protected]31d8f5f22012-04-02 15:22:08411 return shared_->lazy_background_task_queue();
412}
413
[email protected]40404bc2012-07-25 17:40:49414MessageService* ExtensionSystemImpl::message_service() {
[email protected]31d8f5f22012-04-02 15:22:08415 return shared_->message_service();
416}
417
[email protected]5a38dfd2012-07-23 23:22:10418EventRouter* ExtensionSystemImpl::event_router() {
[email protected]31d8f5f22012-04-02 15:22:08419 return shared_->event_router();
420}
421
[email protected]bd306722012-07-11 20:43:59422RulesRegistryService* ExtensionSystemImpl::rules_registry_service() {
[email protected]3dfa4c02012-07-30 17:21:41423 return rules_registry_service_.get();
[email protected]b813ed72012-04-05 08:21:36424}
425
[email protected]931186e02012-07-20 01:22:06426ApiResourceManager<SerialConnection>*
427ExtensionSystemImpl::serial_connection_manager() {
428 return serial_connection_manager_.get();
429}
430
[email protected]3dfa4c02012-07-30 17:21:41431ApiResourceManager<Socket>* ExtensionSystemImpl::socket_manager() {
[email protected]931186e02012-07-20 01:22:06432 return socket_manager_.get();
433}
434
435ApiResourceManager<UsbDeviceResource>*
436ExtensionSystemImpl::usb_device_resource_manager() {
437 return usb_device_resource_manager_.get();
438}
439
[email protected]b4d3771d2012-11-14 14:44:10440ExtensionWarningService* ExtensionSystemImpl::warning_service() {
[email protected]2def34cd2012-12-08 07:07:54441 return shared_->warning_service();
[email protected]b4d3771d2012-11-14 14:44:10442}
443
[email protected]fdd679b2012-11-15 20:49:39444Blacklist* ExtensionSystemImpl::blacklist() {
445 return shared_->blacklist();
446}
447
[email protected]31d8f5f22012-04-02 15:22:08448void ExtensionSystemImpl::RegisterExtensionWithRequestContexts(
[email protected]bd306722012-07-11 20:43:59449 const Extension* extension) {
[email protected]31d8f5f22012-04-02 15:22:08450 base::Time install_time;
[email protected]1d5e58b2013-01-31 08:41:40451 if (extension->location() != Manifest::COMPONENT) {
[email protected]31d8f5f22012-04-02 15:22:08452 install_time = extension_service()->extension_prefs()->
453 GetInstallTime(extension->id());
454 }
455 bool incognito_enabled =
456 extension_service()->IsIncognitoEnabled(extension->id());
457 BrowserThread::PostTask(
458 BrowserThread::IO, FROM_HERE,
459 base::Bind(&ExtensionInfoMap::AddExtension, info_map(),
460 make_scoped_refptr(extension), install_time,
461 incognito_enabled));
462}
463
464void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
465 const std::string& extension_id,
466 const extension_misc::UnloadedExtensionReason reason) {
467 BrowserThread::PostTask(
468 BrowserThread::IO, FROM_HERE,
469 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(),
470 extension_id, reason));
471}
[email protected]bd306722012-07-11 20:43:59472
473} // namespace extensions