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

Unified Diff: extensions/renderer/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
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/js_extension_bindings_system.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/extension_bindings_system.h
diff --git a/extensions/renderer/extension_bindings_system.h b/extensions/renderer/extension_bindings_system.h
new file mode 100644
index 0000000000000000000000000000000000000000..e40858e0751d80eaf4a7a106270f12901e0fa241
--- /dev/null
+++ b/extensions/renderer/extension_bindings_system.h
@@ -0,0 +1,60 @@
+// 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_EXTENSION_BINDINGS_SYSTEM_H_
+#define EXTENSIONS_RENDERER_EXTENSION_BINDINGS_SYSTEM_H_
+
+#include <string>
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+}
+
+namespace extensions {
+class RequestSender;
+class ScriptContext;
+
+// The class responsible for creating extension bindings in different contexts,
+// as well as dispatching requests and handling responses, and dispatching
+// events to listeners.
+// This is designed to be used on a single thread, but should be safe to use on
+// threads other than the main thread (so that worker threads can have extension
+// bindings).
+class ExtensionBindingsSystem {
+ public:
+ virtual ~ExtensionBindingsSystem() {}
+
+ // Called when a new ScriptContext is created.
+ virtual void DidCreateScriptContext(ScriptContext* context) = 0;
+
+ // Called when a ScriptContext is about to be released.
+ virtual void WillReleaseScriptContext(ScriptContext* context) = 0;
+
+ // Updates the bindings for a given |context|. This happens at initialization,
+ // but also when e.g. an extension gets updated permissions.
+ virtual void UpdateBindingsForContext(ScriptContext* context) = 0;
+
+ // Dispatches an event with the given |name|, |event_args|, and
+ // |filtering_info| in the given |context|.
+ virtual void DispatchEventInContext(
+ const std::string& event_name,
+ const base::ListValue* event_args,
+ const base::DictionaryValue* filtering_info,
+ ScriptContext* context) = 0;
+
+ // Handles the response associated with the given |request_id|.
+ virtual void HandleResponse(int request_id,
+ bool success,
+ const base::ListValue& response,
+ const std::string& error) = 0;
+
+ // Returns the associated RequestSender, if any.
+ // TODO(devlin): Factor this out.
+ virtual RequestSender* GetRequestSender() = 0;
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_RENDERER_EXTENSION_BINDINGS_SYSTEM_H_
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/js_extension_bindings_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698