| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Responds to the request with the given |request_id|, calling the callback | 60 // Responds to the request with the given |request_id|, calling the callback |
| 61 // with |response|. If |error| is non-empty, sets the last error. | 61 // with |response|. If |error| is non-empty, sets the last error. |
| 62 void CompleteRequest(int request_id, | 62 void CompleteRequest(int request_id, |
| 63 const base::ListValue& response, | 63 const base::ListValue& response, |
| 64 const std::string& error); | 64 const std::string& error); |
| 65 | 65 |
| 66 // Notifies the APIEventHandler to fire the corresponding event, notifying | 66 // Notifies the APIEventHandler to fire the corresponding event, notifying |
| 67 // listeners. | 67 // listeners. |
| 68 void FireEventInContext(const std::string& event_name, | 68 void FireEventInContext(const std::string& event_name, |
| 69 v8::Local<v8::Context> context, | 69 v8::Local<v8::Context> context, |
| 70 const base::ListValue& response); | 70 const base::ListValue& response, |
| 71 const EventFilteringInfo& filter); |
| 71 | 72 |
| 72 // Returns the APIBindingHooks object for the given api to allow for | 73 // Returns the APIBindingHooks object for the given api to allow for |
| 73 // registering custom hooks. These must be registered *before* the | 74 // registering custom hooks. These must be registered *before* the |
| 74 // binding is instantiated. | 75 // binding is instantiated. |
| 75 // TODO(devlin): It's a little weird that we don't just expose a | 76 // TODO(devlin): It's a little weird that we don't just expose a |
| 76 // RegisterHooks-type method. Depending on how complex the hook interface | 77 // RegisterHooks-type method. Depending on how complex the hook interface |
| 77 // is, maybe we should rethink this. Downside would be that it's less | 78 // is, maybe we should rethink this. Downside would be that it's less |
| 78 // efficient to register multiple hooks for the same API. | 79 // efficient to register multiple hooks for the same API. |
| 79 APIBindingHooks* GetHooksForAPI(const std::string& api_name); | 80 APIBindingHooks* GetHooksForAPI(const std::string& api_name); |
| 80 | 81 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // The method to retrieve the DictionaryValue describing a given extension | 132 // The method to retrieve the DictionaryValue describing a given extension |
| 132 // API. Curried in for testing purposes so we can use fake APIs. | 133 // API. Curried in for testing purposes so we can use fake APIs. |
| 133 GetAPISchemaMethod get_api_schema_; | 134 GetAPISchemaMethod get_api_schema_; |
| 134 | 135 |
| 135 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); | 136 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 } // namespace | 139 } // namespace |
| 139 | 140 |
| 140 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ | 141 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
| OLD | NEW |