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

Unified Diff: extensions/renderer/js_extension_bindings_system.h

Issue 2512233002: [Extensions Bindings] Add ExtensionBindingsSystem interface; hook it up (Closed)
Patch Set: lazyboys Created 4 years, 1 month 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
Index: extensions/renderer/js_extension_bindings_system.h
diff --git a/extensions/renderer/js_extension_bindings_system.h b/extensions/renderer/js_extension_bindings_system.h
new file mode 100644
index 0000000000000000000000000000000000000000..06fe8069aadc98246be4781ed12416db38617eaa
--- /dev/null
+++ b/extensions/renderer/js_extension_bindings_system.h
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_RENDERER_JS_EXTENSION_BINDINGS_SYSTEM_H_
+#define EXTENSIONS_RENDERER_JS_EXTENSION_BINDINGS_SYSTEM_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "extensions/renderer/extension_bindings_system.h"
+
+namespace extensions {
+class RequestSender;
+class ResourceBundleSourceMap;
+
+// The bindings system using the traditional JS-injection style bindings.
+class JsExtensionBindingsSystem : public ExtensionBindingsSystem {
+ public:
+ JsExtensionBindingsSystem(ResourceBundleSourceMap* source_map,
+ std::unique_ptr<RequestSender> request_sender);
+ ~JsExtensionBindingsSystem() override;
+
+ // ExtensionBindingsSystem:
+ void DidCreateScriptContext(ScriptContext* context) override;
+ void WillReleaseScriptContext(ScriptContext* context) override;
+ void UpdateBindingsForContext(ScriptContext* context) override;
+ void DispatchEventInContext(const std::string& event_name,
+ const base::ListValue* event_args,
+ const base::DictionaryValue* filtering_info,
+ ScriptContext* context) override;
+ void HandleResponse(int request_id,
+ bool success,
+ const base::ListValue& response,
+ const std::string& error) override;
+ RequestSender* GetRequestSender() override;
+
+ private:
+ void RegisterBinding(const std::string& api_name, ScriptContext* context);
+
+ ResourceBundleSourceMap* source_map_ = nullptr;
+
+ std::unique_ptr<RequestSender> request_sender_;
+
+ DISALLOW_COPY_AND_ASSIGN(JsExtensionBindingsSystem);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_RENDERER_JS_EXTENSION_BINDINGS_SYSTEM_H_
« no previous file with comments | « extensions/renderer/extension_bindings_system.h ('k') | extensions/renderer/js_extension_bindings_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698