| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_thread.h" | 14 #include "chrome/browser/chrome_thread.h" |
| 15 #include "chrome/browser/debugger/devtools_manager.h" | 15 #include "chrome/browser/debugger/devtools_manager.h" |
| 16 #include "chrome/browser/extensions/crx_installer.h" | 16 #include "chrome/browser/extensions/crx_installer.h" |
| 17 #include "chrome/browser/extensions/extension_browser_event_router.h" | 17 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 18 #include "chrome/browser/extensions/extension_dom_ui.h" | 18 #include "chrome/browser/extensions/extension_dom_ui.h" |
| 19 #include "chrome/browser/extensions/extension_file_util.h" | 19 #include "chrome/browser/extensions/extension_file_util.h" |
| 20 #include "chrome/browser/extensions/extension_history_api.h" | 20 #include "chrome/browser/extensions/extension_history_api.h" |
| 21 #include "chrome/browser/extensions/extension_process_manager.h" | 21 #include "chrome/browser/extensions/extension_process_manager.h" |
| 22 #include "chrome/browser/extensions/extension_updater.h" | 22 #include "chrome/browser/extensions/extension_updater.h" |
| 23 #include "chrome/browser/extensions/external_extension_provider.h" | 23 #include "chrome/browser/extensions/external_extension_provider.h" |
| 24 #include "chrome/browser/extensions/external_pref_extension_provider.h" | 24 #include "chrome/browser/extensions/external_pref_extension_provider.h" |
| 25 #include "chrome/browser/profile.h" | 25 #include "chrome/browser/profile.h" |
| 26 #include "chrome/browser/net/chrome_url_request_context.h" | 26 #include "chrome/browser/net/chrome_url_request_context.h" |
| 27 #include "chrome/common/child_process_logging.h" |
| 27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/extensions/extension.h" | 29 #include "chrome/common/extensions/extension.h" |
| 29 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
| 30 #include "chrome/common/extensions/extension_error_reporter.h" | 31 #include "chrome/common/extensions/extension_error_reporter.h" |
| 31 #include "chrome/common/notification_service.h" | 32 #include "chrome/common/notification_service.h" |
| 32 #include "chrome/common/notification_type.h" | 33 #include "chrome/common/notification_type.h" |
| 33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/pref_service.h" | 35 #include "chrome/common/pref_service.h" |
| 35 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| 36 | 37 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 403 |
| 403 NotificationService::current()->Notify( | 404 NotificationService::current()->Notify( |
| 404 NotificationType::EXTENSION_LOADED, | 405 NotificationType::EXTENSION_LOADED, |
| 405 Source<Profile>(profile_), | 406 Source<Profile>(profile_), |
| 406 Details<Extension>(extension)); | 407 Details<Extension>(extension)); |
| 407 } | 408 } |
| 408 | 409 |
| 409 void ExtensionsService::NotifyExtensionUnloaded(Extension* extension) { | 410 void ExtensionsService::NotifyExtensionUnloaded(Extension* extension) { |
| 410 LOG(INFO) << "Sending EXTENSION_UNLOADED"; | 411 LOG(INFO) << "Sending EXTENSION_UNLOADED"; |
| 411 | 412 |
| 413 UpdateActiveExtensionsInCrashReporter(); |
| 414 |
| 412 NotificationService::current()->Notify( | 415 NotificationService::current()->Notify( |
| 413 NotificationType::EXTENSION_UNLOADED, | 416 NotificationType::EXTENSION_UNLOADED, |
| 414 Source<Profile>(profile_), | 417 Source<Profile>(profile_), |
| 415 Details<Extension>(extension)); | 418 Details<Extension>(extension)); |
| 416 | 419 |
| 417 if (profile_ && !profile_->IsOffTheRecord()) { | 420 if (profile_ && !profile_->IsOffTheRecord()) { |
| 418 ChromeURLRequestContextGetter* context_getter = | 421 ChromeURLRequestContextGetter* context_getter = |
| 419 static_cast<ChromeURLRequestContextGetter*>( | 422 static_cast<ChromeURLRequestContextGetter*>( |
| 420 profile_->GetRequestContext()); | 423 profile_->GetRequestContext()); |
| 421 if (context_getter) { | 424 if (context_getter) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 NotificationType::EXTENSION_UPDATE_DISABLED, | 612 NotificationType::EXTENSION_UPDATE_DISABLED, |
| 610 Source<Profile>(profile_), | 613 Source<Profile>(profile_), |
| 611 Details<Extension>(extension)); | 614 Details<Extension>(extension)); |
| 612 disabled_extensions_.push_back(scoped_extension.release()); | 615 disabled_extensions_.push_back(scoped_extension.release()); |
| 613 break; | 616 break; |
| 614 default: | 617 default: |
| 615 NOTREACHED(); | 618 NOTREACHED(); |
| 616 break; | 619 break; |
| 617 } | 620 } |
| 618 } | 621 } |
| 622 |
| 623 UpdateActiveExtensionsInCrashReporter(); |
| 624 } |
| 625 |
| 626 void ExtensionsService::UpdateActiveExtensionsInCrashReporter() { |
| 627 std::vector<std::string> extension_ids; |
| 628 for (size_t i = 0; i < extensions_.size(); ++i) |
| 629 extension_ids.push_back(extensions_[i]->id()); |
| 630 |
| 631 child_process_logging::SetActiveExtensions(extension_ids); |
| 619 } | 632 } |
| 620 | 633 |
| 621 void ExtensionsService::OnExtensionInstalled(Extension* extension, | 634 void ExtensionsService::OnExtensionInstalled(Extension* extension, |
| 622 bool allow_privilege_increase) { | 635 bool allow_privilege_increase) { |
| 623 extension_prefs_->OnExtensionInstalled(extension); | 636 extension_prefs_->OnExtensionInstalled(extension); |
| 624 | 637 |
| 625 // If the extension is a theme, tell the profile (and therefore ThemeProvider) | 638 // If the extension is a theme, tell the profile (and therefore ThemeProvider) |
| 626 // to apply it. | 639 // to apply it. |
| 627 if (extension->IsTheme()) { | 640 if (extension->IsTheme()) { |
| 628 NotificationService::current()->Notify( | 641 NotificationService::current()->Notify( |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 968 |
| 956 void ExtensionsServiceBackend::OnExternalExtensionFound( | 969 void ExtensionsServiceBackend::OnExternalExtensionFound( |
| 957 const std::string& id, const Version* version, const FilePath& path, | 970 const std::string& id, const Version* version, const FilePath& path, |
| 958 Extension::Location location) { | 971 Extension::Location location) { |
| 959 ChromeThread::PostTask( | 972 ChromeThread::PostTask( |
| 960 ChromeThread::UI, FROM_HERE, | 973 ChromeThread::UI, FROM_HERE, |
| 961 NewRunnableMethod( | 974 NewRunnableMethod( |
| 962 frontend_, &ExtensionsService::OnExternalExtensionFound, id, | 975 frontend_, &ExtensionsService::OnExternalExtensionFound, id, |
| 963 version->GetString(), path, location)); | 976 version->GetString(), path, location)); |
| 964 } | 977 } |
| OLD | NEW |