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

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: Reordered params 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..328d77c5017739a087451656764c1c63e75fd28e 100644
--- a/extensions/common/install_warning.h
+++ b/extensions/common/install_warning.h
@@ -10,24 +10,37 @@
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 reduntant with the message.
Yoyo Zhou 2013/08/15 00:25:13 redundant
Devlin 2013/08/15 16:54:17 Done.
+ return message == other.message;
}
- Format format;
+
+ // The warning's message (human-friendly).
std::string message;
+ // The manifest key to which this warning pertains (e.g., 'permissions').
+ // Optional, as not all warnings need to pertain to a particular key
Yoyo Zhou 2013/08/15 00:25:13 I don't think you need to explain why these fields
Devlin 2013/08/15 16:54:17 Done.
+ // (such as including the private key file in the extension directory).
+ std::string key;
+ // The specific portion of the key which caused the warning. For instance, a
+ // single faulty permission in the 'permissions' key.
+ // Optional, as there sometimes the full key is erroneous (or there may be no
+ // key).
+ 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