| Index: extensions/browser/extension_error.h
|
| diff --git a/extensions/browser/extension_error.h b/extensions/browser/extension_error.h
|
| index 1cd4a7b69bfd6f6252f0b71bf75786f923fcb684..c5be1696e71ab1d9ba99bee385b31621cbe7b1da 100644
|
| --- a/extensions/browser/extension_error.h
|
| +++ b/extensions/browser/extension_error.h
|
| @@ -17,55 +17,71 @@ namespace extensions {
|
| class ExtensionError {
|
| public:
|
| enum Type {
|
| - MANIFEST_PARSING_ERROR,
|
| - JAVASCRIPT_RUNTIME_ERROR
|
| + MANIFEST_ERROR,
|
| + RUNTIME_ERROR
|
| };
|
|
|
| virtual ~ExtensionError();
|
|
|
| virtual std::string PrintForTest() const;
|
|
|
| + // Return true if this error and |rhs| are considered equal, and should be
|
| + // grouped together.
|
| + 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_; }
|
| const std::string& extension_id() const { return extension_id_; }
|
| bool from_incognito() const { return from_incognito_; }
|
| + logging::LogSeverity level() const { return level_; }
|
| + const base::string16& source() const { return source_; }
|
| + const base::string16& message() const { return message_; }
|
| + size_t occurrences() const { return occurrences_; }
|
| + void set_occurrences(size_t occurrences) { occurrences_ = occurrences; }
|
|
|
| protected:
|
| ExtensionError(Type type,
|
| const std::string& extension_id,
|
| bool from_incognito,
|
| + logging::LogSeverity level,
|
| 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.
|
| std::string extension_id_;
|
| // Whether or not the error was caused while incognito.
|
| bool from_incognito_;
|
| + // The severity level of the error.
|
| + logging::LogSeverity level_;
|
| // The source for the error; this can be a script, web page, or manifest file.
|
| // This is stored as a string (rather than a url) since it can be a Chrome
|
| // script file (e.g., event_bindings.js).
|
| base::string16 source_;
|
| // The error message itself.
|
| base::string16 message_;
|
| + // The number of times this error has occurred.
|
| + size_t occurrences_;
|
|
|
| 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);
|
| + virtual ~ManifestError();
|
|
|
| virtual std::string PrintForTest() const OVERRIDE;
|
| private:
|
| - DISALLOW_COPY_AND_ASSIGN(ManifestParsingError);
|
| + virtual bool IsEqualImpl(const ExtensionError* rhs) const OVERRIDE;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ManifestError);
|
| };
|
|
|
| -class JavascriptRuntimeError : public ExtensionError {
|
| +class RuntimeError : public ExtensionError {
|
| public:
|
| struct StackFrame {
|
| size_t line_number;
|
| @@ -84,24 +100,27 @@ 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;
|
|
|
| - logging::LogSeverity level() const { return level_; }
|
| const base::string16& execution_context_url() const {
|
| return execution_context_url_;
|
| }
|
| 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);
|
| @@ -109,11 +128,10 @@ class JavascriptRuntimeError : public ExtensionError {
|
| // reported source, or through the execution context url.
|
| 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
|
|
|