Index: extensions/browser/extension_error.h |
diff --git a/extensions/browser/extension_error.h b/extensions/browser/extension_error.h |
index 1cd4a7b69bfd6f6252f0b71bf75786f923fcb684..bd377205773806506fc573edec1b6c0ed13237b7 100644 |
--- a/extensions/browser/extension_error.h |
+++ b/extensions/browser/extension_error.h |
@@ -10,8 +10,13 @@ |
#include "base/compiler_specific.h" |
#include "base/logging.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/strings/string16.h" |
+namespace base { |
+class DictionaryValue; |
+} |
+ |
namespace extensions { |
class ExtensionError { |
@@ -23,8 +28,13 @@ class ExtensionError { |
virtual ~ExtensionError(); |
+ // Serializes the ExtensionError into JSON format. |
+ virtual scoped_ptr<base::DictionaryValue> ToValue() const; |
+ |
virtual std::string PrintForTest() const; |
+ bool IsEqual(const ExtensionError* rhs) const; |
+ |
Type type() const { return type_; } |
const base::string16& source() const { return source_; } |
const base::string16& message() const { return message_; } |
@@ -38,6 +48,8 @@ class ExtensionError { |
const base::string16& source, |
const base::string16& message); |
+ virtual bool IsEqualImpl(const ExtensionError* rhs) const = 0; |
+ |
// Which type of error this is. |
Type type_; |
// The ID of the extension which caused the error. |
@@ -57,11 +69,27 @@ class ExtensionError { |
class ManifestParsingError : public ExtensionError { |
public: |
ManifestParsingError(const std::string& extension_id, |
- const base::string16& message); |
+ const base::string16& message, |
+ const base::string16& manifest_key, |
+ const base::string16& manifest_specific); |
virtual ~ManifestParsingError(); |
+ virtual scoped_ptr<base::DictionaryValue> ToValue() const OVERRIDE; |
+ |
virtual std::string PrintForTest() const OVERRIDE; |
+ |
+ const base::string16& manifest_key() const { return manifest_key_; } |
+ const base::string16& manifest_specific() const { return manifest_specific_; } |
private: |
+ virtual bool IsEqualImpl(const ExtensionError* rhs) const OVERRIDE; |
+ |
+ // If present, this indicates the feature in the manifest which caused the |
+ // error. |
+ base::string16 manifest_key_; |
+ // If present, this is a more-specific location of the error - for instance, |
+ // a specific permission which is incorrect, rather than simply "permissions". |
+ base::string16 manifest_specific_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ManifestParsingError); |
}; |
@@ -84,6 +112,8 @@ class JavascriptRuntimeError : public ExtensionError { |
const base::string16& frame_function /* can be empty */); |
~StackFrame(); |
+ |
+ bool operator==(const StackFrame& rhs) const; |
}; |
typedef std::vector<StackFrame> StackTrace; |
@@ -102,12 +132,14 @@ class JavascriptRuntimeError : public ExtensionError { |
} |
const StackTrace& stack_trace() const { return stack_trace_; } |
private: |
+ virtual bool IsEqualImpl(const ExtensionError* rhs) const OVERRIDE; |
+ |
// Parse the JSON |details| passed to the error. This includes a stack trace |
// and an execution context url. |
void ParseDetails(const base::string16& details); |
// Try to determine the ID of the extension. This may be obtained through the |
// reported source, or through the execution context url. |
- void DetermineExtensionID(); |
+ void DetermineExtensionId(); |
logging::LogSeverity level_; |
base::string16 execution_context_url_; |