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

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

Issue 10407105: Improve error messaging of webRequest API in case of conflicts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Store ExtensionWarnings as values in set rather than pointers Created 8 years, 3 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
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 163ffdf3b8cf918fd8e800834fb2462fbebc9f75..36c58b7788dc77da5de37a9dfbf50278616c2b9a 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -62,6 +62,7 @@ using content::RenderViewHost;
using content::WebContents;
using extensions::Extension;
using extensions::ExtensionUpdater;
+using extensions::ExtensionWarning;
using extensions::ManagementPolicy;
///////////////////////////////////////////////////////////////////////////////
@@ -106,7 +107,7 @@ void ExtensionSettingsHandler::RegisterUserPrefs(PrefService* prefs) {
DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
const Extension* extension,
const std::vector<ExtensionPage>& pages,
- const ExtensionWarningSet* warnings_set) {
+ const extensions::ExtensionWarningService* warnings_set) {
DictionaryValue* extension_data = new DictionaryValue();
bool enabled = extension_service_->IsExtensionEnabled(extension->id());
extension->GetBasicInfo(enabled, extension_data);
@@ -175,18 +176,14 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
// Add warnings.
if (warnings_set) {
- std::set<ExtensionWarningSet::WarningType> warnings;
- warnings_set->GetWarningsAffectingExtension(extension->id(), &warnings);
+ std::vector<std::string> warnings;
+ warnings_set->GetWarningMessagesForExtension(extension->id(), &warnings);
if (!warnings.empty()) {
ListValue* warnings_list = new ListValue;
- for (std::set<ExtensionWarningSet::WarningType>::const_iterator iter =
- warnings.begin();
- iter != warnings.end();
- ++iter) {
- string16 warning_string(
- ExtensionWarningSet::GetLocalizedWarning(*iter));
- warnings_list->Append(Value::CreateStringValue(warning_string));
+ for (std::vector<std::string>::const_iterator iter = warnings.begin();
+ iter != warnings.end(); ++iter) {
+ warnings_list->Append(Value::CreateStringValue(*iter));
}
extension_data->Set("warnings", warnings_list);
}
@@ -471,10 +468,13 @@ void ExtensionSettingsHandler::HandleRequestExtensionsData(
const ListValue* args) {
DictionaryValue results;
+ Profile* profile = Profile::FromWebUI(web_ui());
+
// Add the extensions to the results structure.
ListValue *extensions_list = new ListValue();
- ExtensionWarningSet* warnings = extension_service_->extension_warnings();
+ extensions::ExtensionWarningService* warnings =
+ extensions::ExtensionSystem::Get(profile)->warning_service();
const ExtensionSet* extensions = extension_service_->extensions();
for (ExtensionSet::const_iterator extension = extensions->begin();
@@ -514,10 +514,10 @@ void ExtensionSettingsHandler::HandleRequestExtensionsData(
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);
+
+ bool developer_mode =
+ profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
+ results.SetBoolean("developerMode", developer_mode);
}
bool load_unpacked_disabled =

Powered by Google App Engine
This is Rietveld 408576698