Index: chromecast/renderer/cast_gin_runner.h |
diff --git a/chromecast/renderer/cast_gin_runner.h b/chromecast/renderer/cast_gin_runner.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2f320e685a2007e6bada28e0649be8f7b6e7b5cd |
--- /dev/null |
+++ b/chromecast/renderer/cast_gin_runner.h |
@@ -0,0 +1,50 @@ |
+// 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 CHROMECAST_RENDERER_CAST_GIN_RUNNER_H_ |
+#define CHROMECAST_RENDERER_CAST_GIN_RUNNER_H_ |
+ |
+#include "base/macros.h" |
+#include "gin/runner.h" |
+ |
+namespace blink { |
+class WebFrame; |
+} |
+ |
+namespace chromecast { |
+namespace shell { |
+ |
+// This class is an exact copy of content::MojoMainRunner used to replicate |
Ken Rockot(use gerrit already)
2016/09/14 21:13:22
nit: This documentation is probably unnecessary an
alokp
2016/09/14 21:55:36
Yes we will move away from gin as well. In fact we
jarhar
2016/09/15 00:32:42
Done.
|
+// logic for enabling a Mojo API in JavaScript for Chromecast. |
+ |
+// Implementation of gin::Runner that forwards Runner functions to WebFrame. |
+class CastGinRunner : public gin::Runner { |
+ public: |
+ // Does not take ownership of ContextHolder. |
+ CastGinRunner(blink::WebFrame* frame, gin::ContextHolder* context_holder); |
+ ~CastGinRunner() override {} |
+ |
+ // Runner overrides: |
+ void Run(const std::string& source, |
+ const std::string& resource_name) override; |
+ v8::Local<v8::Value> Call(v8::Local<v8::Function> function, |
+ v8::Local<v8::Value> receiver, |
+ int argc, |
+ v8::Local<v8::Value> argv[]) override; |
+ gin::ContextHolder* GetContextHolder() override; |
+ |
+ private: |
+ // Frame to execute script in. |
+ blink::WebFrame* frame_; |
derekjchow1
2016/09/14 21:20:13
Can this be blink::WebFrame* const frame_?
jarhar
2016/09/15 00:32:42
Done.
|
+ |
+ // Created by blink bindings to V8. |
+ gin::ContextHolder* context_holder_; |
derekjchow1
2016/09/14 21:20:14
Ditto. Should this variable change over the object
jarhar
2016/09/15 00:32:42
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(CastGinRunner); |
+}; |
+ |
+} // namespace shell |
+} // namespace chromecast |
+ |
+#endif // CHROMECAST_RENDERER_CAST_GIN_RUNNER_H_ |