OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/extensions/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
6 | 6 |
7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "apps/app_restore_service.h" | 8 #include "apps/app_restore_service.h" |
9 #include "apps/app_window.h" | 9 #include "apps/app_window.h" |
10 #include "apps/app_window_registry.h" | 10 #include "apps/app_window_registry.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "content/public/browser/web_ui.h" | 71 #include "content/public/browser/web_ui.h" |
72 #include "content/public/browser/web_ui_data_source.h" | 72 #include "content/public/browser/web_ui_data_source.h" |
73 #include "extensions/browser/blacklist_state.h" | 73 #include "extensions/browser/blacklist_state.h" |
74 #include "extensions/browser/extension_error.h" | 74 #include "extensions/browser/extension_error.h" |
75 #include "extensions/browser/extension_host.h" | 75 #include "extensions/browser/extension_host.h" |
76 #include "extensions/browser/extension_registry.h" | 76 #include "extensions/browser/extension_registry.h" |
77 #include "extensions/browser/extension_system.h" | 77 #include "extensions/browser/extension_system.h" |
78 #include "extensions/browser/lazy_background_task_queue.h" | 78 #include "extensions/browser/lazy_background_task_queue.h" |
79 #include "extensions/browser/management_policy.h" | 79 #include "extensions/browser/management_policy.h" |
80 #include "extensions/browser/pref_names.h" | 80 #include "extensions/browser/pref_names.h" |
| 81 #include "extensions/browser/uninstall_reason.h" |
81 #include "extensions/browser/view_type_utils.h" | 82 #include "extensions/browser/view_type_utils.h" |
82 #include "extensions/common/constants.h" | 83 #include "extensions/common/constants.h" |
83 #include "extensions/common/extension.h" | 84 #include "extensions/common/extension.h" |
84 #include "extensions/common/extension_icon_set.h" | 85 #include "extensions/common/extension_icon_set.h" |
85 #include "extensions/common/extension_set.h" | 86 #include "extensions/common/extension_set.h" |
86 #include "extensions/common/feature_switch.h" | 87 #include "extensions/common/feature_switch.h" |
87 #include "extensions/common/manifest.h" | 88 #include "extensions/common/manifest.h" |
88 #include "extensions/common/manifest_handlers/background_info.h" | 89 #include "extensions/common/manifest_handlers/background_info.h" |
89 #include "extensions/common/manifest_handlers/incognito_info.h" | 90 #include "extensions/common/manifest_handlers/incognito_info.h" |
90 #include "extensions/common/permissions/permissions_data.h" | 91 #include "extensions/common/permissions/permissions_data.h" |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 | 720 |
720 void ExtensionSettingsHandler::OnExtensionUnloaded( | 721 void ExtensionSettingsHandler::OnExtensionUnloaded( |
721 content::BrowserContext* browser_context, | 722 content::BrowserContext* browser_context, |
722 const Extension* extension, | 723 const Extension* extension, |
723 UnloadedExtensionInfo::Reason reason) { | 724 UnloadedExtensionInfo::Reason reason) { |
724 MaybeUpdateAfterNotification(); | 725 MaybeUpdateAfterNotification(); |
725 } | 726 } |
726 | 727 |
727 void ExtensionSettingsHandler::OnExtensionUninstalled( | 728 void ExtensionSettingsHandler::OnExtensionUninstalled( |
728 content::BrowserContext* browser_context, | 729 content::BrowserContext* browser_context, |
729 const Extension* extension) { | 730 const Extension* extension, |
| 731 extensions::UninstallReason reason) { |
730 MaybeUpdateAfterNotification(); | 732 MaybeUpdateAfterNotification(); |
731 } | 733 } |
732 | 734 |
733 void ExtensionSettingsHandler::OnExtensionDisableReasonsChanged( | 735 void ExtensionSettingsHandler::OnExtensionDisableReasonsChanged( |
734 const std::string& extension_id, int disable_reasons) { | 736 const std::string& extension_id, int disable_reasons) { |
735 MaybeUpdateAfterNotification(); | 737 MaybeUpdateAfterNotification(); |
736 } | 738 } |
737 | 739 |
738 void ExtensionSettingsHandler::ExtensionUninstallAccepted() { | 740 void ExtensionSettingsHandler::ExtensionUninstallAccepted() { |
739 DCHECK(!extension_id_prompting_.empty()); | 741 DCHECK(!extension_id_prompting_.empty()); |
740 | 742 |
741 bool was_terminated = false; | 743 bool was_terminated = false; |
742 | 744 |
743 // The extension can be uninstalled in another window while the UI was | 745 // The extension can be uninstalled in another window while the UI was |
744 // showing. Do nothing in that case. | 746 // showing. Do nothing in that case. |
745 const Extension* extension = | 747 const Extension* extension = |
746 extension_service_->GetExtensionById(extension_id_prompting_, true); | 748 extension_service_->GetExtensionById(extension_id_prompting_, true); |
747 if (!extension) { | 749 if (!extension) { |
748 extension = | 750 extension = |
749 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->GetExtensionById( | 751 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->GetExtensionById( |
750 extension_id_prompting_, ExtensionRegistry::TERMINATED); | 752 extension_id_prompting_, ExtensionRegistry::TERMINATED); |
751 was_terminated = true; | 753 was_terminated = true; |
752 } | 754 } |
753 if (!extension) | 755 if (!extension) |
754 return; | 756 return; |
755 | 757 |
756 extension_service_->UninstallExtension( | 758 extension_service_->UninstallExtension( |
757 extension_id_prompting_, | 759 extension_id_prompting_, |
758 ExtensionService::UNINSTALL_REASON_USER_INITIATED, | 760 extensions::UNINSTALL_REASON_USER_INITIATED, |
759 NULL); // Error. | 761 NULL); // Error. |
760 extension_id_prompting_ = ""; | 762 extension_id_prompting_ = ""; |
761 | 763 |
762 // There will be no EXTENSION_UNLOADED notification for terminated | 764 // There will be no EXTENSION_UNLOADED notification for terminated |
763 // extensions as they were already unloaded. | 765 // extensions as they were already unloaded. |
764 if (was_terminated) | 766 if (was_terminated) |
765 HandleRequestExtensionsData(NULL); | 767 HandleRequestExtensionsData(NULL); |
766 } | 768 } |
767 | 769 |
768 void ExtensionSettingsHandler::ExtensionUninstallCanceled() { | 770 void ExtensionSettingsHandler::ExtensionUninstallCanceled() { |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 extension_service_->EnableExtension(extension_id); | 1388 extension_service_->EnableExtension(extension_id); |
1387 } else { | 1389 } else { |
1388 ExtensionErrorReporter::GetInstance()->ReportError( | 1390 ExtensionErrorReporter::GetInstance()->ReportError( |
1389 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1391 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
1390 true); // Be noisy. | 1392 true); // Be noisy. |
1391 } | 1393 } |
1392 requirements_checker_.reset(); | 1394 requirements_checker_.reset(); |
1393 } | 1395 } |
1394 | 1396 |
1395 } // namespace extensions | 1397 } // namespace extensions |
OLD | NEW |