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

Unified Diff: extensions/renderer/native_extension_bindings_system.cc

Issue 2953133002: [Extensions Bindings] Support chrome.extension.lastError (Closed)
Patch Set: jbroman's, lazyboy's Created 3 years, 6 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/renderer/native_extension_bindings_system.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/native_extension_bindings_system.cc
diff --git a/extensions/renderer/native_extension_bindings_system.cc b/extensions/renderer/native_extension_bindings_system.cc
index 94d10aa3a1c3147d714e41c85440ccdc4156b473..d1f8bf1bc8fdd277926e4d2f11d0f300f016e3dc 100644
--- a/extensions/renderer/native_extension_bindings_system.cc
+++ b/extensions/renderer/native_extension_bindings_system.cc
@@ -361,7 +361,8 @@ NativeExtensionBindingsSystem::NativeExtensionBindingsSystem(
base::Unretained(this)),
base::Bind(&NativeExtensionBindingsSystem::OnEventListenerChanged,
base::Unretained(this)),
- APILastError(base::Bind(&GetRuntime), base::Bind(&AddConsoleError))),
+ APILastError(base::Bind(&GetLastErrorParents),
+ base::Bind(&AddConsoleError))),
weak_factory_(this) {
api_system_.RegisterCustomType("storage.StorageArea",
base::Bind(&StorageArea::CreateStorageArea));
@@ -578,8 +579,15 @@ v8::Local<v8::Object> NativeExtensionBindingsSystem::GetAPIHelper(
return root_binding;
}
-v8::Local<v8::Object> NativeExtensionBindingsSystem::GetRuntime(
- v8::Local<v8::Context> context) {
+v8::Local<v8::Object> NativeExtensionBindingsSystem::GetLastErrorParents(
+ v8::Local<v8::Context> context,
+ v8::Local<v8::Object>* secondary_parent) {
+ if (secondary_parent &&
+ IsAPIFeatureAvailable(context, "extension.lastError")) {
+ *secondary_parent = GetAPIHelper(
+ context, gin::StringToSymbol(context->GetIsolate(), "extension"));
+ }
+
return GetAPIHelper(context,
gin::StringToSymbol(context->GetIsolate(), "runtime"));
}
« no previous file with comments | « extensions/renderer/native_extension_bindings_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698