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

Side by Side Diff: extensions/renderer/native_extension_bindings_system.h

Issue 2657613005: [Extensions Bindings] Add chrome.runtime.lastError support (Closed)
Patch Set: . Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_RENDERER_NATIVE_EXTENSION_BINDINGS_SYSTEM_H_ 5 #ifndef EXTENSIONS_RENDERER_NATIVE_EXTENSION_BINDINGS_SYSTEM_H_
6 #define EXTENSIONS_RENDERER_NATIVE_EXTENSION_BINDINGS_SYSTEM_H_ 6 #define EXTENSIONS_RENDERER_NATIVE_EXTENSION_BINDINGS_SYSTEM_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void SendRequest(std::unique_ptr<APIBinding::Request> request, 61 void SendRequest(std::unique_ptr<APIBinding::Request> request,
62 v8::Local<v8::Context> context); 62 v8::Local<v8::Context> context);
63 63
64 // Called when listeners for a given event have changed, and forwards it along 64 // Called when listeners for a given event have changed, and forwards it along
65 // to |send_event_listener_ipc_|. 65 // to |send_event_listener_ipc_|.
66 void OnEventListenerChanged(const std::string& event_name, 66 void OnEventListenerChanged(const std::string& event_name,
67 binding::EventListenersChanged change, 67 binding::EventListenersChanged change,
68 v8::Local<v8::Context> context); 68 v8::Local<v8::Context> context);
69 69
70 // Getter callback for an extension API, since APIs are constructed lazily. 70 // Getter callback for an extension API, since APIs are constructed lazily.
71 static void GetAPIHelper(v8::Local<v8::Name> name, 71 static void BindingAccessor(v8::Local<v8::Name> name,
72 const v8::PropertyCallbackInfo<v8::Value>& info); 72 const v8::PropertyCallbackInfo<v8::Value>& info);
73
74 // Creates and returns the API binding for the given |name|.
75 static v8::Local<v8::Object> GetAPIHelper(v8::Local<v8::Context> context,
76 v8::Local<v8::String> name);
77
78 // Gets the chrome.runtime API binding.
79 static v8::Local<v8::Object> GetRuntime(v8::Local<v8::Context> context);
73 80
74 // Callback to get an API binding for an internal API. 81 // Callback to get an API binding for an internal API.
75 static void GetInternalAPI(const v8::FunctionCallbackInfo<v8::Value>& info); 82 static void GetInternalAPI(const v8::FunctionCallbackInfo<v8::Value>& info);
76 83
77 // Handler to send request IPCs. Abstracted out for testing purposes. 84 // Handler to send request IPCs. Abstracted out for testing purposes.
78 SendRequestIPCMethod send_request_ipc_; 85 SendRequestIPCMethod send_request_ipc_;
79 86
80 // Handler to notify the browser of event registrations. Abstracted out for 87 // Handler to notify the browser of event registrations. Abstracted out for
81 // testing purposes. 88 // testing purposes.
82 SendEventListenerIPCMethod send_event_listener_ipc_; 89 SendEventListenerIPCMethod send_event_listener_ipc_;
83 90
84 // The APIBindingsSystem associated with this class. 91 // The APIBindingsSystem associated with this class.
85 APIBindingsSystem api_system_; 92 APIBindingsSystem api_system_;
86 93
87 // A function to acquire an internal API. 94 // A function to acquire an internal API.
88 v8::Eternal<v8::FunctionTemplate> get_internal_api_; 95 v8::Eternal<v8::FunctionTemplate> get_internal_api_;
89 96
90 base::WeakPtrFactory<NativeExtensionBindingsSystem> weak_factory_; 97 base::WeakPtrFactory<NativeExtensionBindingsSystem> weak_factory_;
91 98
92 DISALLOW_COPY_AND_ASSIGN(NativeExtensionBindingsSystem); 99 DISALLOW_COPY_AND_ASSIGN(NativeExtensionBindingsSystem);
93 }; 100 };
94 101
95 } // namespace extensions 102 } // namespace extensions
96 103
97 #endif // EXTENSIONS_RENDERER_NATIVE_EXTENSION_BINDINGS_SYSTEM_H_ 104 #endif // EXTENSIONS_RENDERER_NATIVE_EXTENSION_BINDINGS_SYSTEM_H_
OLDNEW
« no previous file with comments | « extensions/renderer/api_request_handler_unittest.cc ('k') | extensions/renderer/native_extension_bindings_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698