OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_NATIVE_JAVASCRIPT_H_ | |
6 #define COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_NATIVE_JAVASCRIPT_H_ | |
7 | |
8 #include "components/dom_distiller/content/common/distiller_javascript_service.m ojom.h" | |
9 #include "content/public/renderer/render_frame.h" | |
10 #include "content/public/renderer/render_frame_observer.h" | |
11 #include "v8/include/v8.h" | |
12 | |
13 namespace dom_distiller { | |
14 | |
15 // This class is the primary interface for custom JavaScript introduced by the | |
16 // dom-distiller. Callbacks for JavaScript functionality and the communication | |
17 // channel to the browser process are maintained here. | |
18 class DistillerNativeJavaScript { | |
19 public: | |
20 DistillerNativeJavaScript(content::RenderFrame* render_frame); | |
nyquist
2015/08/11 08:11:55
explicit
mdjones
2015/08/11 16:02:05
Done.
| |
21 ~DistillerNativeJavaScript(); | |
22 | |
23 // Add the "distiller" JavaScript object and its functions to the current | |
24 // |RenderFrame|. | |
25 void AddJavaScriptObjectToFrame(v8::Local<v8::Context> context); | |
26 | |
27 private: | |
28 // Native code for "distiller.echo" in JavaScript. This simply returns the | |
29 // provided string. | |
30 std::string DistillerEcho(const std::string& message); | |
31 | |
32 content::RenderFrame* render_frame_; | |
33 DistillerJavaScriptServicePtr distiller_js_service_; | |
34 }; | |
35 | |
36 // static | |
37 v8::Local<v8::Object> GetOrCreateDistillerObject(v8::Isolate* isolate, | |
38 v8::Local<v8::Object> global); | |
39 | |
40 } // namespace dom_distiller | |
41 | |
42 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_NATIVE_JAVASCRIPT _H_ | |
OLD | NEW |