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 CHROMECAST_RENDERER_CAST_GIN_RUNNER_H_ | |
6 #define CHROMECAST_RENDERER_CAST_GIN_RUNNER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "gin/runner.h" | |
10 | |
11 namespace blink { | |
12 class WebFrame; | |
13 } | |
14 | |
15 namespace chromecast { | |
16 namespace shell { | |
17 | |
18 // 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.
| |
19 // logic for enabling a Mojo API in JavaScript for Chromecast. | |
20 | |
21 // Implementation of gin::Runner that forwards Runner functions to WebFrame. | |
22 class CastGinRunner : public gin::Runner { | |
23 public: | |
24 // Does not take ownership of ContextHolder. | |
25 CastGinRunner(blink::WebFrame* frame, gin::ContextHolder* context_holder); | |
26 ~CastGinRunner() override {} | |
27 | |
28 // Runner overrides: | |
29 void Run(const std::string& source, | |
30 const std::string& resource_name) override; | |
31 v8::Local<v8::Value> Call(v8::Local<v8::Function> function, | |
32 v8::Local<v8::Value> receiver, | |
33 int argc, | |
34 v8::Local<v8::Value> argv[]) override; | |
35 gin::ContextHolder* GetContextHolder() override; | |
36 | |
37 private: | |
38 // Frame to execute script in. | |
39 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.
| |
40 | |
41 // Created by blink bindings to V8. | |
42 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.
| |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(CastGinRunner); | |
45 }; | |
46 | |
47 } // namespace shell | |
48 } // namespace chromecast | |
49 | |
50 #endif // CHROMECAST_RENDERER_CAST_GIN_RUNNER_H_ | |
OLD | NEW |