OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_WEB_UI_RUNNER_H_ | 5 #ifndef CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_ |
6 #define CONTENT_RENDERER_WEB_UI_RUNNER_H_ | 6 #define CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_ |
7 | 7 |
| 8 #include "base/macros.h" |
8 #include "gin/runner.h" | 9 #include "gin/runner.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 class WebFrame; | 12 class WebFrame; |
12 } | 13 } |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 // Implementation of gin::Runner that forwards Runner functions to WebFrame. | 17 // Implementation of gin::Runner that forwards Runner functions to WebFrame. |
17 class WebUIRunner : public gin::Runner { | 18 class MojoMainRunner : public gin::Runner { |
18 public: | 19 public: |
19 // Does not take ownership of ContextHolder. | 20 // Does not take ownership of ContextHolder. |
20 WebUIRunner(blink::WebFrame* frame, gin::ContextHolder* context_holder); | 21 MojoMainRunner(blink::WebFrame* frame, gin::ContextHolder* context_holder); |
21 ~WebUIRunner() override; | 22 ~MojoMainRunner() override; |
22 | 23 |
23 // Runner overrides: | 24 // Runner overrides: |
24 void Run(const std::string& source, | 25 void Run(const std::string& source, |
25 const std::string& resource_name) override; | 26 const std::string& resource_name) override; |
26 v8::Local<v8::Value> Call(v8::Local<v8::Function> function, | 27 v8::Local<v8::Value> Call(v8::Local<v8::Function> function, |
27 v8::Local<v8::Value> receiver, | 28 v8::Local<v8::Value> receiver, |
28 int argc, | 29 int argc, |
29 v8::Local<v8::Value> argv[]) override; | 30 v8::Local<v8::Value> argv[]) override; |
30 gin::ContextHolder* GetContextHolder() override; | 31 gin::ContextHolder* GetContextHolder() override; |
31 | 32 |
32 private: | 33 private: |
33 // Frame to execute script in. | 34 // Frame to execute script in. |
34 blink::WebFrame* frame_; | 35 blink::WebFrame* frame_; |
35 | 36 |
36 // Created by blink bindings to V8. | 37 // Created by blink bindings to V8. |
37 gin::ContextHolder* context_holder_; | 38 gin::ContextHolder* context_holder_; |
38 | 39 |
39 DISALLOW_COPY_AND_ASSIGN(WebUIRunner); | 40 DISALLOW_COPY_AND_ASSIGN(MojoMainRunner); |
40 }; | 41 }; |
41 | 42 |
42 } // namespace content | 43 } // namespace content |
43 | 44 |
44 #endif // CONTENT_RENDERER_WEB_UI_RUNNER_H_ | 45 #endif // CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_ |
OLD | NEW |