| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_ERROR_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_ERROR_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_ERROR_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_ERROR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 private: | 87 private: |
| 88 DISALLOW_COPY_AND_ASSIGN(ExtensionError); | 88 DISALLOW_COPY_AND_ASSIGN(ExtensionError); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 class ManifestError : public ExtensionError { | 91 class ManifestError : public ExtensionError { |
| 92 public: | 92 public: |
| 93 ManifestError(const std::string& extension_id, | 93 ManifestError(const std::string& extension_id, |
| 94 const base::string16& message, | 94 const base::string16& message, |
| 95 const base::string16& manifest_key, | 95 const base::string16& manifest_key, |
| 96 const base::string16& manifest_specific); | 96 const base::string16& manifest_specific); |
| 97 virtual ~ManifestError(); | 97 ~ManifestError() override; |
| 98 | 98 |
| 99 virtual scoped_ptr<base::DictionaryValue> ToValue() const override; | 99 scoped_ptr<base::DictionaryValue> ToValue() const override; |
| 100 | 100 |
| 101 virtual std::string PrintForTest() const override; | 101 std::string PrintForTest() const override; |
| 102 | 102 |
| 103 const base::string16& manifest_key() const { return manifest_key_; } | 103 const base::string16& manifest_key() const { return manifest_key_; } |
| 104 const base::string16& manifest_specific() const { return manifest_specific_; } | 104 const base::string16& manifest_specific() const { return manifest_specific_; } |
| 105 | 105 |
| 106 // Keys used for retrieving JSON values. | 106 // Keys used for retrieving JSON values. |
| 107 static const char kManifestKeyKey[]; | 107 static const char kManifestKeyKey[]; |
| 108 static const char kManifestSpecificKey[]; | 108 static const char kManifestSpecificKey[]; |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 virtual bool IsEqualImpl(const ExtensionError* rhs) const override; | 111 bool IsEqualImpl(const ExtensionError* rhs) const override; |
| 112 | 112 |
| 113 // If present, this indicates the feature in the manifest which caused the | 113 // If present, this indicates the feature in the manifest which caused the |
| 114 // error. | 114 // error. |
| 115 base::string16 manifest_key_; | 115 base::string16 manifest_key_; |
| 116 // If present, this is a more-specific location of the error - for instance, | 116 // If present, this is a more-specific location of the error - for instance, |
| 117 // a specific permission which is incorrect, rather than simply "permissions". | 117 // a specific permission which is incorrect, rather than simply "permissions". |
| 118 base::string16 manifest_specific_; | 118 base::string16 manifest_specific_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(ManifestError); | 120 DISALLOW_COPY_AND_ASSIGN(ManifestError); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 class RuntimeError : public ExtensionError { | 123 class RuntimeError : public ExtensionError { |
| 124 public: | 124 public: |
| 125 RuntimeError(const std::string& extension_id, // optional, sometimes unknown. | 125 RuntimeError(const std::string& extension_id, // optional, sometimes unknown. |
| 126 bool from_incognito, | 126 bool from_incognito, |
| 127 const base::string16& source, | 127 const base::string16& source, |
| 128 const base::string16& message, | 128 const base::string16& message, |
| 129 const StackTrace& stack_trace, | 129 const StackTrace& stack_trace, |
| 130 const GURL& context_url, | 130 const GURL& context_url, |
| 131 logging::LogSeverity level, | 131 logging::LogSeverity level, |
| 132 int render_view_id, | 132 int render_view_id, |
| 133 int render_process_id); | 133 int render_process_id); |
| 134 virtual ~RuntimeError(); | 134 ~RuntimeError() override; |
| 135 | 135 |
| 136 virtual scoped_ptr<base::DictionaryValue> ToValue() const override; | 136 scoped_ptr<base::DictionaryValue> ToValue() const override; |
| 137 | 137 |
| 138 virtual std::string PrintForTest() const override; | 138 std::string PrintForTest() const override; |
| 139 | 139 |
| 140 const GURL& context_url() const { return context_url_; } | 140 const GURL& context_url() const { return context_url_; } |
| 141 const StackTrace& stack_trace() const { return stack_trace_; } | 141 const StackTrace& stack_trace() const { return stack_trace_; } |
| 142 int render_view_id() const { return render_view_id_; } | 142 int render_view_id() const { return render_view_id_; } |
| 143 int render_process_id() const { return render_process_id_; } | 143 int render_process_id() const { return render_process_id_; } |
| 144 | 144 |
| 145 // Keys used for retrieving JSON values. | 145 // Keys used for retrieving JSON values. |
| 146 static const char kColumnNumberKey[]; | 146 static const char kColumnNumberKey[]; |
| 147 static const char kContextUrlKey[]; | 147 static const char kContextUrlKey[]; |
| 148 static const char kFunctionNameKey[]; | 148 static const char kFunctionNameKey[]; |
| 149 static const char kLineNumberKey[]; | 149 static const char kLineNumberKey[]; |
| 150 static const char kStackTraceKey[]; | 150 static const char kStackTraceKey[]; |
| 151 static const char kUrlKey[]; | 151 static const char kUrlKey[]; |
| 152 static const char kRenderProcessIdKey[]; | 152 static const char kRenderProcessIdKey[]; |
| 153 static const char kRenderViewIdKey[]; | 153 static const char kRenderViewIdKey[]; |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 virtual bool IsEqualImpl(const ExtensionError* rhs) const override; | 156 bool IsEqualImpl(const ExtensionError* rhs) const override; |
| 157 | 157 |
| 158 // Since we piggy-back onto other error reporting systems (like V8 and | 158 // Since we piggy-back onto other error reporting systems (like V8 and |
| 159 // WebKit), the reported information may need to be cleaned up in order to be | 159 // WebKit), the reported information may need to be cleaned up in order to be |
| 160 // in a consistent format. | 160 // in a consistent format. |
| 161 void CleanUpInit(); | 161 void CleanUpInit(); |
| 162 | 162 |
| 163 GURL context_url_; | 163 GURL context_url_; |
| 164 StackTrace stack_trace_; | 164 StackTrace stack_trace_; |
| 165 | 165 |
| 166 // Keep track of the render process which caused the error in order to | 166 // Keep track of the render process which caused the error in order to |
| 167 // inspect the view later, if possible. | 167 // inspect the view later, if possible. |
| 168 int render_view_id_; | 168 int render_view_id_; |
| 169 int render_process_id_; | 169 int render_process_id_; |
| 170 | 170 |
| 171 DISALLOW_COPY_AND_ASSIGN(RuntimeError); | 171 DISALLOW_COPY_AND_ASSIGN(RuntimeError); |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 } // namespace extensions | 174 } // namespace extensions |
| 175 | 175 |
| 176 #endif // EXTENSIONS_BROWSER_EXTENSION_ERROR_H_ | 176 #endif // EXTENSIONS_BROWSER_EXTENSION_ERROR_H_ |
| OLD | NEW |