OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_impl.h" | 5 #include "chrome/browser/extensions/extension_system_impl.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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/strings/string_tokenizer.h" | 14 #include "base/strings/string_tokenizer.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/content_settings/cookie_settings.h" | 18 #include "chrome/browser/content_settings/cookie_settings.h" |
19 #include "chrome/browser/extensions/component_loader.h" | 19 #include "chrome/browser/extensions/component_loader.h" |
20 #include "chrome/browser/extensions/error_console/error_console.h" | |
21 #include "chrome/browser/extensions/extension_error_reporter.h" | 20 #include "chrome/browser/extensions/extension_error_reporter.h" |
22 #include "chrome/browser/extensions/extension_management.h" | 21 #include "chrome/browser/extensions/extension_management.h" |
23 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
24 #include "chrome/browser/extensions/extension_system_factory.h" | 23 #include "chrome/browser/extensions/extension_system_factory.h" |
25 #include "chrome/browser/extensions/extension_util.h" | 24 #include "chrome/browser/extensions/extension_util.h" |
26 #include "chrome/browser/extensions/install_verifier.h" | 25 #include "chrome/browser/extensions/install_verifier.h" |
27 #include "chrome/browser/extensions/navigation_observer.h" | 26 #include "chrome/browser/extensions/navigation_observer.h" |
28 #include "chrome/browser/extensions/shared_module_service.h" | 27 #include "chrome/browser/extensions/shared_module_service.h" |
29 #include "chrome/browser/extensions/shared_user_script_master.h" | 28 #include "chrome/browser/extensions/shared_user_script_master.h" |
30 #include "chrome/browser/extensions/state_store_notification_observer.h" | 29 #include "chrome/browser/extensions/state_store_notification_observer.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 base::ThreadRestrictions::ScopedAllowIO allow_io; | 370 base::ThreadRestrictions::ScopedAllowIO allow_io; |
372 extension_service_->component_loader()->AddOrReplace( | 371 extension_service_->component_loader()->AddOrReplace( |
373 base::FilePath(t.token())); | 372 base::FilePath(t.token())); |
374 } | 373 } |
375 } | 374 } |
376 extension_service_->Init(); | 375 extension_service_->Init(); |
377 | 376 |
378 // Make the chrome://extension-icon/ resource available. | 377 // Make the chrome://extension-icon/ resource available. |
379 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); | 378 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); |
380 | 379 |
381 error_console_.reset(new ErrorConsole(profile_)); | |
382 quota_service_.reset(new QuotaService); | 380 quota_service_.reset(new QuotaService); |
383 | 381 |
384 if (extensions_enabled) { | 382 if (extensions_enabled) { |
385 // Load any extensions specified with --load-extension. | 383 // Load any extensions specified with --load-extension. |
386 // TODO(yoz): Seems like this should move into ExtensionService::Init. | 384 // TODO(yoz): Seems like this should move into ExtensionService::Init. |
387 // But maybe it's no longer important. | 385 // But maybe it's no longer important. |
388 if (command_line->HasSwitch(switches::kLoadExtension)) { | 386 if (command_line->HasSwitch(switches::kLoadExtension)) { |
389 base::CommandLine::StringType path_list = | 387 base::CommandLine::StringType path_list = |
390 command_line->GetSwitchValueNative(switches::kLoadExtension); | 388 command_line->GetSwitchValueNative(switches::kLoadExtension); |
391 base::StringTokenizerT<base::CommandLine::StringType, | 389 base::StringTokenizerT<base::CommandLine::StringType, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 443 |
446 LazyBackgroundTaskQueue* | 444 LazyBackgroundTaskQueue* |
447 ExtensionSystemImpl::Shared::lazy_background_task_queue() { | 445 ExtensionSystemImpl::Shared::lazy_background_task_queue() { |
448 return lazy_background_task_queue_.get(); | 446 return lazy_background_task_queue_.get(); |
449 } | 447 } |
450 | 448 |
451 EventRouter* ExtensionSystemImpl::Shared::event_router() { | 449 EventRouter* ExtensionSystemImpl::Shared::event_router() { |
452 return event_router_.get(); | 450 return event_router_.get(); |
453 } | 451 } |
454 | 452 |
455 ErrorConsole* ExtensionSystemImpl::Shared::error_console() { | |
456 return error_console_.get(); | |
457 } | |
458 | |
459 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { | 453 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { |
460 return install_verifier_.get(); | 454 return install_verifier_.get(); |
461 } | 455 } |
462 | 456 |
463 QuotaService* ExtensionSystemImpl::Shared::quota_service() { | 457 QuotaService* ExtensionSystemImpl::Shared::quota_service() { |
464 return quota_service_.get(); | 458 return quota_service_.get(); |
465 } | 459 } |
466 | 460 |
467 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { | 461 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { |
468 return content_verifier_.get(); | 462 return content_verifier_.get(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 528 } |
535 | 529 |
536 EventRouter* ExtensionSystemImpl::event_router() { | 530 EventRouter* ExtensionSystemImpl::event_router() { |
537 return shared_->event_router(); | 531 return shared_->event_router(); |
538 } | 532 } |
539 | 533 |
540 const OneShotEvent& ExtensionSystemImpl::ready() const { | 534 const OneShotEvent& ExtensionSystemImpl::ready() const { |
541 return shared_->ready(); | 535 return shared_->ready(); |
542 } | 536 } |
543 | 537 |
544 ErrorConsole* ExtensionSystemImpl::error_console() { | |
545 return shared_->error_console(); | |
546 } | |
547 | |
548 InstallVerifier* ExtensionSystemImpl::install_verifier() { | 538 InstallVerifier* ExtensionSystemImpl::install_verifier() { |
549 return shared_->install_verifier(); | 539 return shared_->install_verifier(); |
550 } | 540 } |
551 | 541 |
552 QuotaService* ExtensionSystemImpl::quota_service() { | 542 QuotaService* ExtensionSystemImpl::quota_service() { |
553 return shared_->quota_service(); | 543 return shared_->quota_service(); |
554 } | 544 } |
555 | 545 |
556 ContentVerifier* ExtensionSystemImpl::content_verifier() { | 546 ContentVerifier* ExtensionSystemImpl::content_verifier() { |
557 return shared_->content_verifier(); | 547 return shared_->content_verifier(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 584 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
595 const std::string& extension_id, | 585 const std::string& extension_id, |
596 const UnloadedExtensionInfo::Reason reason) { | 586 const UnloadedExtensionInfo::Reason reason) { |
597 BrowserThread::PostTask( | 587 BrowserThread::PostTask( |
598 BrowserThread::IO, | 588 BrowserThread::IO, |
599 FROM_HERE, | 589 FROM_HERE, |
600 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 590 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
601 } | 591 } |
602 | 592 |
603 } // namespace extensions | 593 } // namespace extensions |
OLD | NEW |