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

Unified Diff: extensions/common/install_warning.h

Issue 22470007: Add a "key" entry to InstallWarnings, remove InstallWarning::Format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_infrastructure
Patch Set: Created 7 years, 4 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
« no previous file with comments | « chrome/common/extensions/permissions/permissions_data.cc ('k') | extensions/common/install_warning.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/install_warning.h
diff --git a/extensions/common/install_warning.h b/extensions/common/install_warning.h
index fb3fccb29b6e6de7be242e83b0295aff933f9d24..88dd0a1aa275cf3c94d31bac55283742b085ae8e 100644
--- a/extensions/common/install_warning.h
+++ b/extensions/common/install_warning.h
@@ -10,24 +10,34 @@
namespace extensions {
+// A struct to describe a non-fatal issue discovered in the installation of an
+// extension.
struct InstallWarning {
- enum Format {
- // IMPORTANT: Do not build HTML strings from user or developer-supplied
- // input.
- FORMAT_TEXT,
- FORMAT_HTML,
- };
- static InstallWarning Text(const std::string& message) {
- return InstallWarning(FORMAT_TEXT, message);
- }
- InstallWarning(Format format, const std::string& message)
- : format(format), message(message) {
- }
+ InstallWarning(const std::string& message);
+ InstallWarning(const std::string& message,
+ const std::string& key);
+ InstallWarning(const std::string& message,
+ const std::string& key,
+ const std::string& specific);
+ ~InstallWarning();
+
bool operator==(const InstallWarning& other) const {
- return format == other.format && message == other.message;
+ // We don't have to look at |key| or |specific| here, because they are each
+ // used in the the message itself.
+ // For example, a full message would be "Permission 'foo' is unknown or URL
+ // pattern is malformed." |key| here is "permissions", and |specific| is
+ // "foo", but these are redundant with the message.
+ return message == other.message;
}
- Format format;
+
+ // The warning's message (human-friendly).
std::string message;
+ // Optional - for specifying the incorrect key in the manifest (e.g.,
+ // "permissions").
+ std::string key;
+ // Optional - for specifying the incorrect portion of a key in the manifest
+ // (e.g., an unrecognized permission "foo" in "permissions").
+ std::string specific;
};
// Let gtest print InstallWarnings.
« no previous file with comments | « chrome/common/extensions/permissions/permissions_data.cc ('k') | extensions/common/install_warning.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698