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