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/extension_system.h" | 5 #include "chrome/browser/extensions/extension_system.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/extensions/user_script_master.h" | 32 #include "chrome/browser/extensions/user_script_master.h" |
33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
34 #include "chrome/browser/profiles/profile_manager.h" | 34 #include "chrome/browser/profiles/profile_manager.h" |
35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
36 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/chrome_version_info.h" | 37 #include "chrome/common/chrome_version_info.h" |
38 #include "chrome/common/extensions/features/feature_channel.h" | 38 #include "chrome/common/extensions/features/feature_channel.h" |
39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/url_data_source.h" | 40 #include "content/public/browser/url_data_source.h" |
41 #include "extensions/browser/event_router.h" | 41 #include "extensions/browser/event_router.h" |
| 42 #include "extensions/browser/extension_registry.h" |
42 #include "extensions/browser/info_map.h" | 43 #include "extensions/browser/info_map.h" |
43 #include "extensions/browser/lazy_background_task_queue.h" | 44 #include "extensions/browser/lazy_background_task_queue.h" |
44 #include "extensions/browser/management_policy.h" | 45 #include "extensions/browser/management_policy.h" |
45 #include "extensions/browser/process_manager.h" | 46 #include "extensions/browser/process_manager.h" |
| 47 #include "extensions/browser/runtime_data.h" |
46 #include "extensions/common/constants.h" | 48 #include "extensions/common/constants.h" |
47 #include "extensions/common/extension.h" | 49 #include "extensions/common/extension.h" |
48 #include "extensions/common/manifest.h" | 50 #include "extensions/common/manifest.h" |
49 | 51 |
50 #if defined(ENABLE_NOTIFICATIONS) | 52 #if defined(ENABLE_NOTIFICATIONS) |
51 #include "chrome/browser/notifications/desktop_notification_service.h" | 53 #include "chrome/browser/notifications/desktop_notification_service.h" |
52 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 54 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
53 #include "ui/message_center/notifier_settings.h" | 55 #include "ui/message_center/notifier_settings.h" |
54 #endif | 56 #endif |
55 | 57 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { | 163 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { |
162 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 164 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
163 | 165 |
164 navigation_observer_.reset(new NavigationObserver(profile_)); | 166 navigation_observer_.reset(new NavigationObserver(profile_)); |
165 | 167 |
166 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); | 168 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); |
167 ExtensionErrorReporter::Init(allow_noisy_errors); | 169 ExtensionErrorReporter::Init(allow_noisy_errors); |
168 | 170 |
169 user_script_master_ = new UserScriptMaster(profile_); | 171 user_script_master_ = new UserScriptMaster(profile_); |
170 | 172 |
| 173 // ExtensionService depends on RuntimeData. |
| 174 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); |
| 175 |
171 bool autoupdate_enabled = true; | 176 bool autoupdate_enabled = true; |
172 #if defined(OS_CHROMEOS) | 177 #if defined(OS_CHROMEOS) |
173 if (!extensions_enabled) | 178 if (!extensions_enabled) |
174 autoupdate_enabled = false; | 179 autoupdate_enabled = false; |
175 else | 180 else |
176 autoupdate_enabled = | 181 autoupdate_enabled = |
177 !command_line->HasSwitch(chromeos::switches::kGuestSession); | 182 !command_line->HasSwitch(chromeos::switches::kGuestSession); |
178 #endif | 183 #endif |
179 extension_service_.reset(new ExtensionService( | 184 extension_service_.reset(new ExtensionService( |
180 profile_, | 185 profile_, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 277 } |
273 | 278 |
274 StateStore* ExtensionSystemImpl::Shared::rules_store() { | 279 StateStore* ExtensionSystemImpl::Shared::rules_store() { |
275 return rules_store_.get(); | 280 return rules_store_.get(); |
276 } | 281 } |
277 | 282 |
278 ExtensionService* ExtensionSystemImpl::Shared::extension_service() { | 283 ExtensionService* ExtensionSystemImpl::Shared::extension_service() { |
279 return extension_service_.get(); | 284 return extension_service_.get(); |
280 } | 285 } |
281 | 286 |
| 287 RuntimeData* ExtensionSystemImpl::Shared::runtime_data() { |
| 288 return runtime_data_.get(); |
| 289 } |
| 290 |
282 ManagementPolicy* ExtensionSystemImpl::Shared::management_policy() { | 291 ManagementPolicy* ExtensionSystemImpl::Shared::management_policy() { |
283 return management_policy_.get(); | 292 return management_policy_.get(); |
284 } | 293 } |
285 | 294 |
286 UserScriptMaster* ExtensionSystemImpl::Shared::user_script_master() { | 295 UserScriptMaster* ExtensionSystemImpl::Shared::user_script_master() { |
287 return user_script_master_.get(); | 296 return user_script_master_.get(); |
288 } | 297 } |
289 | 298 |
290 InfoMap* ExtensionSystemImpl::Shared::info_map() { | 299 InfoMap* ExtensionSystemImpl::Shared::info_map() { |
291 if (!extension_info_map_.get()) | 300 if (!extension_info_map_.get()) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 359 |
351 process_manager_.reset(ProcessManager::Create(profile_)); | 360 process_manager_.reset(ProcessManager::Create(profile_)); |
352 | 361 |
353 shared_->Init(extensions_enabled); | 362 shared_->Init(extensions_enabled); |
354 } | 363 } |
355 | 364 |
356 ExtensionService* ExtensionSystemImpl::extension_service() { | 365 ExtensionService* ExtensionSystemImpl::extension_service() { |
357 return shared_->extension_service(); | 366 return shared_->extension_service(); |
358 } | 367 } |
359 | 368 |
| 369 RuntimeData* ExtensionSystemImpl::runtime_data() { |
| 370 return shared_->runtime_data(); |
| 371 } |
| 372 |
360 ManagementPolicy* ExtensionSystemImpl::management_policy() { | 373 ManagementPolicy* ExtensionSystemImpl::management_policy() { |
361 return shared_->management_policy(); | 374 return shared_->management_policy(); |
362 } | 375 } |
363 | 376 |
364 UserScriptMaster* ExtensionSystemImpl::user_script_master() { | 377 UserScriptMaster* ExtensionSystemImpl::user_script_master() { |
365 return shared_->user_script_master(); | 378 return shared_->user_script_master(); |
366 } | 379 } |
367 | 380 |
368 ProcessManager* ExtensionSystemImpl::process_manager() { | 381 ProcessManager* ExtensionSystemImpl::process_manager() { |
369 return process_manager_.get(); | 382 return process_manager_.get(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 452 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
440 const std::string& extension_id, | 453 const std::string& extension_id, |
441 const UnloadedExtensionInfo::Reason reason) { | 454 const UnloadedExtensionInfo::Reason reason) { |
442 BrowserThread::PostTask( | 455 BrowserThread::PostTask( |
443 BrowserThread::IO, | 456 BrowserThread::IO, |
444 FROM_HERE, | 457 FROM_HERE, |
445 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 458 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
446 } | 459 } |
447 | 460 |
448 } // namespace extensions | 461 } // namespace extensions |
OLD | NEW |