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