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