Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: extensions/browser/extension_error.cc

Issue 22647007: Resubmit 21609003: Move ExtensionError to extensions/, add error limits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/extension_error.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_error.cc
diff --git a/chrome/browser/extensions/error_console/extension_error.cc b/extensions/browser/extension_error.cc
similarity index 89%
rename from chrome/browser/extensions/error_console/extension_error.cc
rename to extensions/browser/extension_error.cc
index 9d8944cedbc505f812d6205154bfada96f4fbb5c..8b6196c4200967605b3eb51f0653035bd4e88744 100644
--- a/chrome/browser/extensions/error_console/extension_error.cc
+++ b/extensions/browser/extension_error.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/extensions/error_console/extension_error.h"
+#include "extensions/browser/extension_error.h"
#include "base/json/json_reader.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/common/extensions/extension.h"
#include "extensions/common/constants.h"
+#include "url/gurl.h"
using base::string16;
@@ -28,7 +28,7 @@ const char kStackTraceKey[] = "stackTrace";
// populates |extension_id| with the ID. On failure, returns false and leaves
// extension_id untouched.
bool GetExtensionIDFromGURL(const GURL& url, std::string* extension_id) {
- if (url.SchemeIs(extensions::kExtensionScheme)) {
+ if (url.SchemeIs(kExtensionScheme)) {
*extension_id = url.host();
return true;
}
@@ -38,10 +38,12 @@ bool GetExtensionIDFromGURL(const GURL& url, std::string* extension_id) {
} // namespace
ExtensionError::ExtensionError(Type type,
+ const std::string& extension_id,
bool from_incognito,
const string16& source,
const string16& message)
: type_(type),
+ extension_id_(extension_id),
from_incognito_(from_incognito),
source_(source),
message_(message) {
@@ -58,15 +60,13 @@ std::string ExtensionError::PrintForTest() const {
"\n ID: " + extension_id_;
}
-ManifestParsingError::ManifestParsingError(bool from_incognito,
- const string16& source,
- const string16& message,
- size_t line_number)
+ManifestParsingError::ManifestParsingError(const std::string& extension_id,
+ const string16& message)
: ExtensionError(ExtensionError::MANIFEST_PARSING_ERROR,
- from_incognito,
- source,
- message),
- line_number_(line_number) {
+ extension_id,
+ false, // extensions can't be installed while incognito.
+ base::FilePath(kManifestFilename).AsUTF16Unsafe(),
+ message) {
}
ManifestParsingError::~ManifestParsingError() {
@@ -74,8 +74,7 @@ ManifestParsingError::~ManifestParsingError() {
std::string ManifestParsingError::PrintForTest() const {
return ExtensionError::PrintForTest() +
- "\n Type: ManifestParsingError" +
- "\n Line: " + base::IntToString(line_number_);
+ "\n Type: ManifestParsingError";
}
JavascriptRuntimeError::StackFrame::StackFrame() : line_number(-1),
@@ -101,6 +100,7 @@ JavascriptRuntimeError::JavascriptRuntimeError(bool from_incognito,
logging::LogSeverity level,
const string16& details)
: ExtensionError(ExtensionError::JAVASCRIPT_RUNTIME_ERROR,
+ std::string(), // We don't know the id yet.
from_incognito,
source,
message),
« no previous file with comments | « extensions/browser/extension_error.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698