Chromium Code Reviews| 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. |