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