Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8617)

Unified Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 11189094: Implement sideload wipeout for Extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/extensions/extension_settings_handler.cc
===================================================================
--- chrome/browser/ui/webui/extensions/extension_settings_handler.cc (revision 162977)
+++ chrome/browser/ui/webui/extensions/extension_settings_handler.cc (working copy)
@@ -45,6 +45,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/extensions/extension_set.h"
+#include "chrome/common/extensions/feature_switch.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/notification_service.h"
@@ -144,7 +145,26 @@
extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app());
extension_data->SetBoolean("homepageProvided",
extension->GetHomepageURL().is_valid());
+ string16 automatically_disabled_text;
+ int disable_reasons =
+ extension_service_->extension_prefs()->GetDisableReasons(extension->id());
+ if ((disable_reasons & Extension::DISABLE_SIDELOAD_WIPEOUT) != 0) {
+ automatically_disabled_text = l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SIDELOAD_WIPEOUT_AUTOMATIC_DISABLE);
+ }
+ extension_data->SetString("disableReason", automatically_disabled_text);
+ string16 location_text;
+ if (extension->location() == Extension::INTERNAL &&
+ !extension->from_webstore()) {
+ location_text = l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SIDELOAD_WIPEOUT_DISABLE_REASON_UNKNOWN);
+ } else if (extension->location() == Extension::EXTERNAL_REGISTRY) {
+ location_text = l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SIDELOAD_WIPEOUT_DISABLE_REASON_3RD_PARTY);
+ }
+ extension_data->SetString("locationText", location_text);
+
// Determine the sort order: Extensions loaded through --load-extensions show
// up at the top. Disabled extensions show up at the bottom.
if (extension->location() == Extension::LOAD)
@@ -284,6 +304,12 @@
l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED));
localized_strings->SetString("extensionSettingsManagedMode",
l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_MANAGED_MODE));
+ localized_strings->SetString("extensionSettingsSideloadWipeout",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SIDELOAD_WIPEOUT_BANNER));
+ localized_strings->SetString("sideloadWipeoutUrl",
+ chrome::kSideloadWipeoutHelpURL);
+ localized_strings->SetString("sideloadWipoutLearnMore",
+ l10n_util::GetStringUTF16(IDS_LEARN_MORE));
localized_strings->SetString("extensionSettingsShowButton",
l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_BUTTON));
localized_strings->SetString("extensionSettingsLoadUnpackedButton",
@@ -523,12 +549,24 @@
results.SetBoolean("developerMode", false);
} else {
results.SetBoolean("managedMode", false);
- Profile* profile = Profile::FromWebUI(web_ui());
- bool developer_mode =
- profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
- results.SetBoolean("developerMode", developer_mode);
+ Profile* profile = Profile::FromWebUI(web_ui());
+ bool developer_mode =
+ profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
+ results.SetBoolean("developerMode", developer_mode);
}
+ // Check to see if we have any wiped out extensions.
+ Profile* profile = Profile::FromWebUI(web_ui());
+ ExtensionService* extension_service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
+ scoped_ptr<const ExtensionSet> wiped_out(
+ extension_service->GenerateSideloadWipoutExtensionsSet());
+ bool show_sideload_wipeout_extension_banner =
+ extensions::FeatureSwitch::sideload_wipeout()->IsEnabled() &&
+ (wiped_out->size() > 0);
+ results.SetBoolean("showDisabledExtensionsWarning",
+ show_sideload_wipeout_extension_banner);
+
bool load_unpacked_disabled =
extension_service_->extension_prefs()->ExtensionsBlacklistedByDefault();
results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled);

Powered by Google App Engine
This is Rietveld 408576698