blob: c138c4266139d8ad2afbe903bf4c427ef1cb3dba [file] [log] [blame]
[email protected]4fa18202014-03-13 06:19:261// 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
rockot4a038f92015-11-24 21:52:465#ifndef CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_
6#define CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_
[email protected]4fa18202014-03-13 06:19:267
rockot4a038f92015-11-24 21:52:468#include "base/macros.h"
[email protected]4fa18202014-03-13 06:19:269#include "gin/runner.h"
10
11namespace blink {
12class WebFrame;
13}
14
15namespace content {
16
17// Implementation of gin::Runner that forwards Runner functions to WebFrame.
rockot4a038f92015-11-24 21:52:4618class MojoMainRunner : public gin::Runner {
[email protected]4fa18202014-03-13 06:19:2619 public:
20 // Does not take ownership of ContextHolder.
rockot4a038f92015-11-24 21:52:4621 MojoMainRunner(blink::WebFrame* frame, gin::ContextHolder* context_holder);
22 ~MojoMainRunner() override;
[email protected]4fa18202014-03-13 06:19:2623
[email protected]4fa18202014-03-13 06:19:2624 // Runner overrides:
dcheng6d18e402014-10-21 12:32:5225 void Run(const std::string& source,
26 const std::string& resource_name) override;
deepak.s750d68f2015-04-30 07:32:4127 v8::Local<v8::Value> Call(v8::Local<v8::Function> function,
28 v8::Local<v8::Value> receiver,
dcheng6d18e402014-10-21 12:32:5229 int argc,
deepak.s750d68f2015-04-30 07:32:4130 v8::Local<v8::Value> argv[]) override;
dcheng6d18e402014-10-21 12:32:5231 gin::ContextHolder* GetContextHolder() override;
[email protected]4fa18202014-03-13 06:19:2632
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
rockot4a038f92015-11-24 21:52:4640 DISALLOW_COPY_AND_ASSIGN(MojoMainRunner);
[email protected]4fa18202014-03-13 06:19:2641};
42
43} // namespace content
44
rockot4a038f92015-11-24 21:52:4645#endif // CONTENT_RENDERER_MOJO_MAIN_RUNNER_H_