Chromium Code Reviews| Index: chrome/browser/ui/webui/extensions/extension_settings_handler.cc |
| diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc |
| index 92cdd553cc938cea3a8fedfcf0735177164d8d64..30627a292fac131b4a87ca6651c167a8ad5fd3b2 100644 |
| --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc |
| +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc |
| @@ -20,7 +20,6 @@ |
| #include "chrome/browser/background/background_contents.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| -#include "chrome/browser/extensions/error_console/error_console.h" |
| #include "chrome/browser/extensions/extension_management.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| #include "chrome/browser/extensions/extension_tab_util.h" |
| @@ -99,11 +98,8 @@ ExtensionSettingsHandler::ExtensionSettingsHandler() |
| deleting_rph_id_(-1), |
| registered_for_notifications_(false), |
| warning_service_observer_(this), |
| - error_console_observer_(this), |
| extension_prefs_observer_(this), |
| - extension_registry_observer_(this), |
| - extension_management_observer_(this), |
| - should_do_verification_check_(false) { |
| + extension_management_observer_(this) { |
| } |
| ExtensionSettingsHandler::~ExtensionSettingsHandler() { |
| @@ -368,10 +364,6 @@ void ExtensionSettingsHandler::RegisterMessages() { |
| AsWeakPtr())); |
| } |
| -void ExtensionSettingsHandler::OnErrorAdded(const ExtensionError* error) { |
| - MaybeUpdateAfterNotification(); |
| -} |
| - |
| void ExtensionSettingsHandler::Observe( |
| int type, |
| const content::NotificationSource& source, |
| @@ -425,26 +417,6 @@ void ExtensionSettingsHandler::Observe( |
| } |
| } |
| -void ExtensionSettingsHandler::OnExtensionLoaded( |
| - content::BrowserContext* browser_context, |
| - const Extension* extension) { |
| - MaybeUpdateAfterNotification(); |
| -} |
| - |
| -void ExtensionSettingsHandler::OnExtensionUnloaded( |
| - content::BrowserContext* browser_context, |
| - const Extension* extension, |
| - UnloadedExtensionInfo::Reason reason) { |
| - MaybeUpdateAfterNotification(); |
| -} |
| - |
| -void ExtensionSettingsHandler::OnExtensionUninstalled( |
| - content::BrowserContext* browser_context, |
| - const Extension* extension, |
| - extensions::UninstallReason reason) { |
| - MaybeUpdateAfterNotification(); |
| -} |
| - |
| void ExtensionSettingsHandler::OnExtensionDisableReasonsChanged( |
| const std::string& extension_id, int disable_reasons) { |
| MaybeUpdateAfterNotification(); |
| @@ -498,10 +470,10 @@ void ExtensionSettingsHandler::HandleRequestExtensionsData( |
| // Promote the Chrome Apps & Extensions Developer Tools if they are not |
| // installed and the user has not previously dismissed the warning. |
| + ExtensionRegistry* registry = ExtensionRegistry::Get(profile); |
| bool promote_apps_dev_tools = false; |
| - if (!ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))-> |
| - GetExtensionById(kAppsDeveloperToolsExtensionId, |
| - ExtensionRegistry::EVERYTHING) && |
| + if (!registry->GetExtensionById(kAppsDeveloperToolsExtensionId, |
| + ExtensionRegistry::EVERYTHING) && |
| !profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDismissedADTPromo)) { |
| promote_apps_dev_tools = true; |
| } |
| @@ -516,14 +488,26 @@ void ExtensionSettingsHandler::HandleRequestExtensionsData( |
| "extensions.ExtensionSettings.returnExtensionsData", results); |
| MaybeRegisterForNotifications(); |
| - UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck", |
| - should_do_verification_check_); |
| - if (should_do_verification_check_) { |
| - should_do_verification_check_ = false; |
| - ExtensionSystem::Get(Profile::FromWebUI(web_ui())) |
| - ->install_verifier() |
| - ->VerifyAllExtensions(); |
| + |
| + scoped_ptr<ExtensionSet> extensions = |
| + registry->GenerateInstalledExtensionsSet(ExtensionRegistry::ENABLED | |
| + ExtensionRegistry::DISABLED | |
| + ExtensionRegistry::TERMINATED); |
| + ExtensionPrefs* prefs = ExtensionPrefs::Get(profile); |
| + bool should_do_verification_check = false; |
| + for (const scoped_refptr<const Extension>& extension : *extensions) { |
| + if (ui_util::ShouldDisplayInExtensionSettings(extension.get(), profile) && |
| + ((prefs->GetDisableReasons(extension->id()) & |
| + Extension::DISABLE_NOT_VERIFIED) != 0)) { |
|
Dan Beam
2015/04/06 23:53:12
nit: don't need the != 0
Devlin
2015/04/07 16:07:54
Last I checked, we do need the != 0 for windows ma
|
| + should_do_verification_check = true; |
| + break; |
| + } |
|
Dan Beam
2015/04/06 23:53:12
nit:
if (ui_util::ShouldDisplayInExtensionSetti
Devlin
2015/04/07 16:07:54
Okay.
|
| } |
| + |
| + UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck", |
| + should_do_verification_check); |
| + if (should_do_verification_check) |
| + ExtensionSystem::Get(profile)->install_verifier()->VerifyAllExtensions(); |
| } |
| void ExtensionSettingsHandler::HandleToggleDeveloperMode( |
| @@ -650,14 +634,10 @@ void ExtensionSettingsHandler::MaybeRegisterForNotifications() { |
| content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| content::NotificationService::AllBrowserContextsAndSources()); |
| - extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); |
| - |
| content::WebContentsObserver::Observe(web_ui()->GetWebContents()); |
| warning_service_observer_.Add(WarningService::Get(profile)); |
| - error_console_observer_.Add(ErrorConsole::Get(profile)); |
| - |
| extension_management_observer_.Add( |
| ExtensionManagementFactory::GetForBrowserContext(profile)); |
| } |