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