| 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 "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/content_settings/cookie_settings.h" | 18 #include "chrome/browser/content_settings/cookie_settings.h" |
| 18 #include "chrome/browser/extensions/component_loader.h" | 19 #include "chrome/browser/extensions/component_loader.h" |
| 19 #include "chrome/browser/extensions/declarative_user_script_manager.h" | 20 #include "chrome/browser/extensions/declarative_user_script_manager.h" |
| 20 #include "chrome/browser/extensions/error_console/error_console.h" | 21 #include "chrome/browser/extensions/error_console/error_console.h" |
| 21 #include "chrome/browser/extensions/extension_error_reporter.h" | 22 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 22 #include "chrome/browser/extensions/extension_management.h" | 23 #include "chrome/browser/extensions/extension_management.h" |
| 23 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 24 #include "chrome/browser/extensions/extension_system_factory.h" | 25 #include "chrome/browser/extensions/extension_system_factory.h" |
| 25 #include "chrome/browser/extensions/extension_util.h" | 26 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // For reporting metrics in BOOTSTRAP mode, when an extension would be | 288 // For reporting metrics in BOOTSTRAP mode, when an extension would be |
| 288 // disabled if content verification was in ENFORCE mode. | 289 // disabled if content verification was in ENFORCE mode. |
| 289 std::set<std::string> would_be_disabled_ids_; | 290 std::set<std::string> would_be_disabled_ids_; |
| 290 | 291 |
| 291 DISALLOW_COPY_AND_ASSIGN(ContentVerifierDelegateImpl); | 292 DISALLOW_COPY_AND_ASSIGN(ContentVerifierDelegateImpl); |
| 292 }; | 293 }; |
| 293 | 294 |
| 294 } // namespace | 295 } // namespace |
| 295 | 296 |
| 296 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { | 297 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { |
| 298 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init"); |
| 297 const base::CommandLine* command_line = | 299 const base::CommandLine* command_line = |
| 298 base::CommandLine::ForCurrentProcess(); | 300 base::CommandLine::ForCurrentProcess(); |
| 299 | 301 |
| 300 navigation_observer_.reset(new NavigationObserver(profile_)); | 302 navigation_observer_.reset(new NavigationObserver(profile_)); |
| 301 | 303 |
| 302 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); | 304 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); |
| 303 ExtensionErrorReporter::Init(allow_noisy_errors); | 305 ExtensionErrorReporter::Init(allow_noisy_errors); |
| 304 | 306 |
| 305 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); | 307 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); |
| 306 declarative_user_script_manager_.reset( | 308 declarative_user_script_manager_.reset( |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 } | 481 } |
| 480 } | 482 } |
| 481 | 483 |
| 482 ExtensionSystemImpl::~ExtensionSystemImpl() { | 484 ExtensionSystemImpl::~ExtensionSystemImpl() { |
| 483 } | 485 } |
| 484 | 486 |
| 485 void ExtensionSystemImpl::Shutdown() { | 487 void ExtensionSystemImpl::Shutdown() { |
| 486 } | 488 } |
| 487 | 489 |
| 488 void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) { | 490 void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) { |
| 491 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::InitForRegularProfile"); |
| 489 DCHECK(!profile_->IsOffTheRecord()); | 492 DCHECK(!profile_->IsOffTheRecord()); |
| 490 if (shared_user_script_master() || extension_service()) | 493 if (shared_user_script_master() || extension_service()) |
| 491 return; // Already initialized. | 494 return; // Already initialized. |
| 492 | 495 |
| 493 // The InfoMap needs to be created before the ProcessManager. | 496 // The InfoMap needs to be created before the ProcessManager. |
| 494 shared_->info_map(); | 497 shared_->info_map(); |
| 495 shared_->Init(extensions_enabled); | 498 shared_->Init(extensions_enabled); |
| 496 } | 499 } |
| 497 | 500 |
| 498 ExtensionService* ExtensionSystemImpl::extension_service() { | 501 ExtensionService* ExtensionSystemImpl::extension_service() { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 594 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
| 592 const std::string& extension_id, | 595 const std::string& extension_id, |
| 593 const UnloadedExtensionInfo::Reason reason) { | 596 const UnloadedExtensionInfo::Reason reason) { |
| 594 BrowserThread::PostTask( | 597 BrowserThread::PostTask( |
| 595 BrowserThread::IO, | 598 BrowserThread::IO, |
| 596 FROM_HERE, | 599 FROM_HERE, |
| 597 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 600 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
| 598 } | 601 } |
| 599 | 602 |
| 600 } // namespace extensions | 603 } // namespace extensions |
| OLD | NEW |