| 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_bookmarks_module.h" | 17 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 18 #include "chrome/browser/extensions/extension_browser_event_router.h" | 18 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 19 #include "chrome/browser/extensions/extension_dom_ui.h" | 19 #include "chrome/browser/extensions/extension_dom_ui.h" |
| 20 #include "chrome/browser/extensions/extension_file_util.h" | 20 #include "chrome/browser/extensions/extension_file_util.h" |
| 21 #include "chrome/browser/extensions/extension_history_api.h" | 21 #include "chrome/browser/extensions/extension_history_api.h" |
| 22 #include "chrome/browser/extensions/extension_process_manager.h" | 22 #include "chrome/browser/extensions/extension_process_manager.h" |
| 23 #include "chrome/browser/extensions/extension_updater.h" | 23 #include "chrome/browser/extensions/extension_updater.h" |
| 24 #include "chrome/browser/extensions/external_extension_provider.h" | 24 #include "chrome/browser/extensions/external_extension_provider.h" |
| 25 #include "chrome/browser/extensions/external_pref_extension_provider.h" | 25 #include "chrome/browser/extensions/external_pref_extension_provider.h" |
| 26 #include "chrome/browser/profile.h" | 26 #include "chrome/browser/profile.h" |
| 27 #include "chrome/browser/net/chrome_url_request_context.h" | 27 #include "chrome/browser/net/chrome_url_request_context.h" |
| 28 #include "chrome/common/child_process_logging.h" | |
| 29 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/extensions/extension.h" | 29 #include "chrome/common/extensions/extension.h" |
| 31 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
| 32 #include "chrome/common/extensions/extension_error_reporter.h" | 31 #include "chrome/common/extensions/extension_error_reporter.h" |
| 33 #include "chrome/common/notification_service.h" | 32 #include "chrome/common/notification_service.h" |
| 34 #include "chrome/common/notification_type.h" | 33 #include "chrome/common/notification_type.h" |
| 35 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/common/pref_service.h" | 35 #include "chrome/common/pref_service.h" |
| 37 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| 38 | 37 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 | 403 |
| 405 NotificationService::current()->Notify( | 404 NotificationService::current()->Notify( |
| 406 NotificationType::EXTENSION_LOADED, | 405 NotificationType::EXTENSION_LOADED, |
| 407 Source<Profile>(profile_), | 406 Source<Profile>(profile_), |
| 408 Details<Extension>(extension)); | 407 Details<Extension>(extension)); |
| 409 } | 408 } |
| 410 | 409 |
| 411 void ExtensionsService::NotifyExtensionUnloaded(Extension* extension) { | 410 void ExtensionsService::NotifyExtensionUnloaded(Extension* extension) { |
| 412 LOG(INFO) << "Sending EXTENSION_UNLOADED"; | 411 LOG(INFO) << "Sending EXTENSION_UNLOADED"; |
| 413 | 412 |
| 414 UpdateActiveExtensionsInCrashReporter(); | |
| 415 | |
| 416 NotificationService::current()->Notify( | 413 NotificationService::current()->Notify( |
| 417 NotificationType::EXTENSION_UNLOADED, | 414 NotificationType::EXTENSION_UNLOADED, |
| 418 Source<Profile>(profile_), | 415 Source<Profile>(profile_), |
| 419 Details<Extension>(extension)); | 416 Details<Extension>(extension)); |
| 420 | 417 |
| 421 if (profile_ && !profile_->IsOffTheRecord()) { | 418 if (profile_ && !profile_->IsOffTheRecord()) { |
| 422 ChromeURLRequestContextGetter* context_getter = | 419 ChromeURLRequestContextGetter* context_getter = |
| 423 static_cast<ChromeURLRequestContextGetter*>( | 420 static_cast<ChromeURLRequestContextGetter*>( |
| 424 profile_->GetRequestContext()); | 421 profile_->GetRequestContext()); |
| 425 if (context_getter) { | 422 if (context_getter) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 NotificationType::EXTENSION_UPDATE_DISABLED, | 614 NotificationType::EXTENSION_UPDATE_DISABLED, |
| 618 Source<Profile>(profile_), | 615 Source<Profile>(profile_), |
| 619 Details<Extension>(extension)); | 616 Details<Extension>(extension)); |
| 620 disabled_extensions_.push_back(scoped_extension.release()); | 617 disabled_extensions_.push_back(scoped_extension.release()); |
| 621 break; | 618 break; |
| 622 default: | 619 default: |
| 623 NOTREACHED(); | 620 NOTREACHED(); |
| 624 break; | 621 break; |
| 625 } | 622 } |
| 626 } | 623 } |
| 627 | |
| 628 UpdateActiveExtensionsInCrashReporter(); | |
| 629 } | |
| 630 | |
| 631 void ExtensionsService::UpdateActiveExtensionsInCrashReporter() { | |
| 632 std::vector<std::string> extension_ids; | |
| 633 for (size_t i = 0; i < extensions_.size(); ++i) | |
| 634 extension_ids.push_back(extensions_[i]->id()); | |
| 635 | |
| 636 child_process_logging::SetActiveExtensions(extension_ids); | |
| 637 } | 624 } |
| 638 | 625 |
| 639 void ExtensionsService::OnExtensionInstalled(Extension* extension, | 626 void ExtensionsService::OnExtensionInstalled(Extension* extension, |
| 640 bool allow_privilege_increase) { | 627 bool allow_privilege_increase) { |
| 641 extension_prefs_->OnExtensionInstalled(extension); | 628 extension_prefs_->OnExtensionInstalled(extension); |
| 642 | 629 |
| 643 // If the extension is a theme, tell the profile (and therefore ThemeProvider) | 630 // If the extension is a theme, tell the profile (and therefore ThemeProvider) |
| 644 // to apply it. | 631 // to apply it. |
| 645 if (extension->IsTheme()) { | 632 if (extension->IsTheme()) { |
| 646 NotificationService::current()->Notify( | 633 NotificationService::current()->Notify( |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 | 960 |
| 974 void ExtensionsServiceBackend::OnExternalExtensionFound( | 961 void ExtensionsServiceBackend::OnExternalExtensionFound( |
| 975 const std::string& id, const Version* version, const FilePath& path, | 962 const std::string& id, const Version* version, const FilePath& path, |
| 976 Extension::Location location) { | 963 Extension::Location location) { |
| 977 ChromeThread::PostTask( | 964 ChromeThread::PostTask( |
| 978 ChromeThread::UI, FROM_HERE, | 965 ChromeThread::UI, FROM_HERE, |
| 979 NewRunnableMethod( | 966 NewRunnableMethod( |
| 980 frontend_, &ExtensionsService::OnExternalExtensionFound, id, | 967 frontend_, &ExtensionsService::OnExternalExtensionFound, id, |
| 981 version->GetString(), path, location)); | 968 version->GetString(), path, location)); |
| 982 } | 969 } |
| OLD | NEW |