Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h

Issue 1231083007: Expose distiller functions to JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-content
Patch Set: Clean up Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_JS_RENDER_FRAME_OBSE RVER_H_
6 #define COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_OBSE RVER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "components/dom_distiller/content/common/distiller_javascript_service.m ojom.h"
10 #include "components/dom_distiller/content/renderer/distiller_native_javascript. h"
11 #include "components/dom_distiller/content/renderer/distiller_page_notifier_serv ice_impl.h"
12 #include "content/public/renderer/render_frame.h"
13 #include "content/public/renderer/render_frame_observer.h"
14 #include "third_party/WebKit/public/web/WebLocalFrame.h"
15 #include "v8/include/v8.h"
16
17 namespace dom_distiller {
18
19 class DistillerJsRenderFrameObserver : public content::RenderFrameObserver {
20 public:
21 DistillerJsRenderFrameObserver(content::RenderFrame* render_frame,
22 const int distiller_isolated_world_id);
23 // RenderFrameObserver implementation.
24 void DidStartProvisionalLoad() override;
25 void DidFinishLoad() override;
26 void DidCreateScriptContext(v8::Local<v8::Context> context,
27 int extension_group,
28 int world_id) override;
29 ~DistillerJsRenderFrameObserver() override;
30
31 // Add the mojo service to a RenderFrame's service registry.
32 void RegisterMojoService();
33 // Flag the current page as a distiller page.
34 void SetIsDistillerPage();
35
36 private:
37 void createDistillerPageNotifierService(
nyquist 2015/08/11 08:11:55 Create*
mdjones 2015/08/11 16:02:05 Done.
38 mojo::InterfaceRequest<DistillerPageNotifierService> request);
39
40 // The isolated world that the distiller object should be written to.
41 int distiller_isolated_world_id_;
42
43 // Track if the current page is distilled. This is needed for testing.
44 bool is_distiller_page_;
45
46 // Handle to "distiller" JavaScript object functionality.
47 scoped_ptr<DistillerNativeJavaScript> native_javascript_handle_;
48 base::WeakPtrFactory<DistillerJsRenderFrameObserver> weak_factory_;
49 };
50
51 } // namespace dom_distiller
52
53 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_O BSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698