| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_RENDERER_JS_EXTENSION_BINDINGS_SYSTEM_H_ |
| 6 #define EXTENSIONS_RENDERER_JS_EXTENSION_BINDINGS_SYSTEM_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "extensions/renderer/extension_bindings_system.h" |
| 13 |
| 14 namespace extensions { |
| 15 class RequestSender; |
| 16 class ResourceBundleSourceMap; |
| 17 |
| 18 // The bindings system using the traditional JS-injection style bindings. |
| 19 class JsExtensionBindingsSystem : public ExtensionBindingsSystem { |
| 20 public: |
| 21 JsExtensionBindingsSystem(ResourceBundleSourceMap* source_map, |
| 22 std::unique_ptr<RequestSender> request_sender); |
| 23 ~JsExtensionBindingsSystem() override; |
| 24 |
| 25 // ExtensionBindingsSystem: |
| 26 void DidCreateScriptContext(ScriptContext* context) override; |
| 27 void WillReleaseScriptContext(ScriptContext* context) override; |
| 28 void UpdateBindingsForContext(ScriptContext* context) override; |
| 29 void DispatchEventInContext(const std::string& event_name, |
| 30 const base::ListValue* event_args, |
| 31 const base::DictionaryValue* filtering_info, |
| 32 ScriptContext* context) override; |
| 33 void HandleResponse(int request_id, |
| 34 bool success, |
| 35 const base::ListValue& response, |
| 36 const std::string& error) override; |
| 37 RequestSender* GetRequestSender() override; |
| 38 |
| 39 private: |
| 40 void RegisterBinding(const std::string& api_name, ScriptContext* context); |
| 41 |
| 42 ResourceBundleSourceMap* source_map_ = nullptr; |
| 43 |
| 44 std::unique_ptr<RequestSender> request_sender_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(JsExtensionBindingsSystem); |
| 47 }; |
| 48 |
| 49 } // namespace extensions |
| 50 |
| 51 #endif // EXTENSIONS_RENDERER_JS_EXTENSION_BINDINGS_SYSTEM_H_ |
| OLD | NEW |