[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 1 | // Copyright 2014 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 | |||||
rockot | 4a038f9 | 2015-11-24 21:52:46 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_ |
6 | #define CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_ | ||||
[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 7 | |
rockot | 4a038f9 | 2015-11-24 21:52:46 | [diff] [blame] | 8 | #include "base/macros.h" |
[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 9 | #include "gin/runner.h" |
10 | |||||
11 | namespace blink { | ||||
12 | class WebFrame; | ||||
13 | } | ||||
14 | |||||
15 | namespace content { | ||||
16 | |||||
17 | // Implementation of gin::Runner that forwards Runner functions to WebFrame. | ||||
rockot | 4a038f9 | 2015-11-24 21:52:46 | [diff] [blame] | 18 | class MojoMainRunner : public gin::Runner { |
[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 19 | public: |
20 | // Does not take ownership of ContextHolder. | ||||
rockot | 4a038f9 | 2015-11-24 21:52:46 | [diff] [blame] | 21 | MojoMainRunner(blink::WebFrame* frame, gin::ContextHolder* context_holder); |
22 | ~MojoMainRunner() override; | ||||
[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 23 | |
[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 24 | // Runner overrides: |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 25 | void Run(const std::string& source, |
26 | const std::string& resource_name) override; | ||||
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 27 | v8::Local<v8::Value> Call(v8::Local<v8::Function> function, |
28 | v8::Local<v8::Value> receiver, | ||||
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 29 | int argc, |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 30 | v8::Local<v8::Value> argv[]) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 31 | gin::ContextHolder* GetContextHolder() override; |
[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 32 | |
33 | private: | ||||
34 | // Frame to execute script in. | ||||
35 | blink::WebFrame* frame_; | ||||
36 | |||||
37 | // Created by blink bindings to V8. | ||||
38 | gin::ContextHolder* context_holder_; | ||||
39 | |||||
rockot | 4a038f9 | 2015-11-24 21:52:46 | [diff] [blame] | 40 | DISALLOW_COPY_AND_ASSIGN(MojoMainRunner); |
[email protected] | 4fa1820 | 2014-03-13 06:19:26 | [diff] [blame] | 41 | }; |
42 | |||||
43 | } // namespace content | ||||
44 | |||||
rockot | 4a038f9 | 2015-11-24 21:52:46 | [diff] [blame] | 45 | #endif // CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_ |