| Index: extensions/browser/extension_error.h
|
| diff --git a/extensions/browser/extension_error.h b/extensions/browser/extension_error.h
|
| index 1cd4a7b69bfd6f6252f0b71bf75786f923fcb684..1b3d7a97d4e00642b5f6793f03ce58de36748936 100644
|
| --- a/extensions/browser/extension_error.h
|
| +++ b/extensions/browser/extension_error.h
|
| @@ -10,21 +10,31 @@
|
|
|
| #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 {
|
| public:
|
| enum Type {
|
| - MANIFEST_PARSING_ERROR,
|
| - JAVASCRIPT_RUNTIME_ERROR
|
| + MANIFEST_ERROR,
|
| + RUNTIME_ERROR
|
| };
|
|
|
| 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.
|
| @@ -54,18 +66,34 @@ class ExtensionError {
|
| DISALLOW_COPY_AND_ASSIGN(ExtensionError);
|
| };
|
|
|
| -class ManifestParsingError : public ExtensionError {
|
| +class ManifestError : public ExtensionError {
|
| public:
|
| - ManifestParsingError(const std::string& extension_id,
|
| - const base::string16& message);
|
| - virtual ~ManifestParsingError();
|
| + ManifestError(const std::string& extension_id,
|
| + const base::string16& message,
|
| + const base::string16& manifest_key,
|
| + const base::string16& manifest_specific);
|
| + virtual ~ManifestError();
|
| +
|
| + 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:
|
| - DISALLOW_COPY_AND_ASSIGN(ManifestParsingError);
|
| + 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(ManifestError);
|
| };
|
|
|
| -class JavascriptRuntimeError : public ExtensionError {
|
| +class RuntimeError : public ExtensionError {
|
| public:
|
| struct StackFrame {
|
| size_t line_number;
|
| @@ -84,15 +112,17 @@ class JavascriptRuntimeError : public ExtensionError {
|
| const base::string16& frame_function /* can be empty */);
|
|
|
| ~StackFrame();
|
| +
|
| + bool operator==(const StackFrame& rhs) const;
|
| };
|
| typedef std::vector<StackFrame> StackTrace;
|
|
|
| - JavascriptRuntimeError(bool from_incognito,
|
| - const base::string16& source,
|
| - const base::string16& message,
|
| - logging::LogSeverity level,
|
| - const base::string16& details);
|
| - virtual ~JavascriptRuntimeError();
|
| + RuntimeError(bool from_incognito,
|
| + const base::string16& source,
|
| + const base::string16& message,
|
| + logging::LogSeverity level,
|
| + const base::string16& details);
|
| + virtual ~RuntimeError();
|
|
|
| virtual std::string PrintForTest() const OVERRIDE;
|
|
|
| @@ -102,18 +132,20 @@ 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_;
|
| StackTrace stack_trace_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(JavascriptRuntimeError);
|
| + DISALLOW_COPY_AND_ASSIGN(RuntimeError);
|
| };
|
|
|
| } // namespace extensions
|
|
|