| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_OBSE
RVER_H_ | 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_ | 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_OBSE
RVER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "components/dom_distiller/content/common/distiller_javascript_service.m
ojom.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" | 10 #include "components/dom_distiller/content/renderer/distiller_native_javascript.
h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class DistillerJsRenderFrameObserver : public content::RenderFrameObserver { | 23 class DistillerJsRenderFrameObserver : public content::RenderFrameObserver { |
| 24 public: | 24 public: |
| 25 DistillerJsRenderFrameObserver(content::RenderFrame* render_frame, | 25 DistillerJsRenderFrameObserver(content::RenderFrame* render_frame, |
| 26 const int distiller_isolated_world_id); | 26 const int distiller_isolated_world_id); |
| 27 ~DistillerJsRenderFrameObserver() override; | 27 ~DistillerJsRenderFrameObserver() override; |
| 28 | 28 |
| 29 // RenderFrameObserver implementation. | 29 // RenderFrameObserver implementation. |
| 30 void DidStartProvisionalLoad() override; | 30 void DidStartProvisionalLoad() override; |
| 31 void DidFinishLoad() override; | 31 void DidFinishLoad() override; |
| 32 void DidCreateScriptContext(v8::Local<v8::Context> context, | 32 void DidCreateScriptContext(v8::Local<v8::Context> context, |
| 33 int extension_group, | |
| 34 int world_id) override; | 33 int world_id) override; |
| 35 | 34 |
| 36 // Add the mojo interface to a RenderFrame's | 35 // Add the mojo interface to a RenderFrame's |
| 37 // service_manager::InterfaceRegistry. | 36 // service_manager::InterfaceRegistry. |
| 38 void RegisterMojoInterface(); | 37 void RegisterMojoInterface(); |
| 39 // Flag the current page as a distiller page. | 38 // Flag the current page as a distiller page. |
| 40 void SetIsDistillerPage(); | 39 void SetIsDistillerPage(); |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 void CreateDistillerPageNotifierService( | 42 void CreateDistillerPageNotifierService( |
| 44 mojo::InterfaceRequest<mojom::DistillerPageNotifierService> request); | 43 mojo::InterfaceRequest<mojom::DistillerPageNotifierService> request); |
| 45 | 44 |
| 46 // RenderFrameObserver implementation. | 45 // RenderFrameObserver implementation. |
| 47 void OnDestruct() override; | 46 void OnDestruct() override; |
| 48 | 47 |
| 49 // The isolated world that the distiller object should be written to. | 48 // The isolated world that the distiller object should be written to. |
| 50 int distiller_isolated_world_id_; | 49 int distiller_isolated_world_id_; |
| 51 | 50 |
| 52 // Track if the current page is distilled. This is needed for testing. | 51 // Track if the current page is distilled. This is needed for testing. |
| 53 bool is_distiller_page_; | 52 bool is_distiller_page_; |
| 54 | 53 |
| 55 // Handle to "distiller" JavaScript object functionality. | 54 // Handle to "distiller" JavaScript object functionality. |
| 56 std::unique_ptr<DistillerNativeJavaScript> native_javascript_handle_; | 55 std::unique_ptr<DistillerNativeJavaScript> native_javascript_handle_; |
| 57 base::WeakPtrFactory<DistillerJsRenderFrameObserver> weak_factory_; | 56 base::WeakPtrFactory<DistillerJsRenderFrameObserver> weak_factory_; |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 } // namespace dom_distiller | 59 } // namespace dom_distiller |
| 61 | 60 |
| 62 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_O
BSERVER_H_ | 61 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_O
BSERVER_H_ |
| OLD | NEW |