Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_API_BINDINGS_SYSTEM_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
| 6 #define EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ | 6 #define EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 APIBindingsSystem(const binding::RunJSFunction& call_js, | 51 APIBindingsSystem(const binding::RunJSFunction& call_js, |
| 52 const GetAPISchemaMethod& get_api_schema, | 52 const GetAPISchemaMethod& get_api_schema, |
| 53 const SendRequestMethod& send_request); | 53 const SendRequestMethod& send_request); |
| 54 ~APIBindingsSystem(); | 54 ~APIBindingsSystem(); |
| 55 | 55 |
| 56 // Returns a new v8::Object representing the api specified by |api_name|. | 56 // Returns a new v8::Object representing the api specified by |api_name|. |
| 57 v8::Local<v8::Object> CreateAPIInstance( | 57 v8::Local<v8::Object> CreateAPIInstance( |
| 58 const std::string& api_name, | 58 const std::string& api_name, |
| 59 v8::Local<v8::Context> context, | 59 v8::Local<v8::Context> context, |
| 60 v8::Isolate* isolate, | 60 v8::Isolate* isolate, |
| 61 const APIBinding::AvailabilityCallback& is_available); | 61 const APIBinding::AvailabilityCallback& is_available, |
| 62 v8::Local<v8::Object>* hooks_interface_out); | |
|
Devlin
2016/12/16 01:55:49
I don't particularly love this interface, but unfo
| |
| 62 | 63 |
| 63 // Responds to the request with the given |request_id|, calling the callback | 64 // Responds to the request with the given |request_id|, calling the callback |
| 64 // with |response|. | 65 // with |response|. |
| 65 void CompleteRequest(int request_id, const base::ListValue& response); | 66 void CompleteRequest(int request_id, const base::ListValue& response); |
| 66 | 67 |
| 67 // Notifies the APIEventHandler to fire the corresponding event, notifying | 68 // Notifies the APIEventHandler to fire the corresponding event, notifying |
| 68 // listeners. | 69 // listeners. |
| 69 void FireEventInContext(const std::string& event_name, | 70 void FireEventInContext(const std::string& event_name, |
| 70 v8::Local<v8::Context> context, | 71 v8::Local<v8::Context> context, |
| 71 const base::ListValue& response); | 72 const base::ListValue& response); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 // purposes. Typically, this would send an IPC to the browser to begin the | 120 // purposes. Typically, this would send an IPC to the browser to begin the |
| 120 // function work. | 121 // function work. |
| 121 SendRequestMethod send_request_; | 122 SendRequestMethod send_request_; |
| 122 | 123 |
| 123 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); | 124 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 } // namespace | 127 } // namespace |
| 127 | 128 |
| 128 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ | 129 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
| OLD | NEW |