| 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" |
| 11 #include "components/dom_distiller/content/renderer/distiller_page_notifier_serv
ice_impl.h" | 11 #include "components/dom_distiller/content/renderer/distiller_page_notifier_serv
ice_impl.h" |
| 12 #include "content/public/renderer/render_frame.h" | 12 #include "content/public/renderer/render_frame.h" |
| 13 #include "content/public/renderer/render_frame_observer.h" | 13 #include "content/public/renderer/render_frame_observer.h" |
| 14 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 14 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
| 16 | 16 |
| 17 namespace dom_distiller { | 17 namespace dom_distiller { |
| 18 | 18 |
| 19 // DistillerJsRenderFrame observer waits for a page to be loaded and then | 19 // DistillerJsRenderFrame observer waits for a page to be loaded and then |
| 20 // tried to connect to a mojo service hosted in the browser process. The | 20 // tried to connect to a mojo service hosted in the browser process. The |
| 21 // service will tell this render process if the current page is a distiller | 21 // service will tell this render process if the current page is a distiller |
| 22 // page. | 22 // page. |
| 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(blink::WebDataSource* datasource) 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, | 33 int extension_group, |
| 34 int world_id) override; | 34 int world_id) override; |
| 35 | 35 |
| 36 // Add the mojo service to a RenderFrame's service registry. | 36 // Add the mojo service to a RenderFrame's service registry. |
| 37 void RegisterMojoService(); | 37 void RegisterMojoService(); |
| 38 // Flag the current page as a distiller page. | 38 // Flag the current page as a distiller page. |
| 39 void SetIsDistillerPage(); | 39 void SetIsDistillerPage(); |
| 40 | 40 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 51 //mojo::StrongBinding<DistillerPageNotifierService> binding_; | 51 //mojo::StrongBinding<DistillerPageNotifierService> binding_; |
| 52 | 52 |
| 53 // Handle to "distiller" JavaScript object functionality. | 53 // Handle to "distiller" JavaScript object functionality. |
| 54 scoped_ptr<DistillerNativeJavaScript> native_javascript_handle_; | 54 scoped_ptr<DistillerNativeJavaScript> native_javascript_handle_; |
| 55 base::WeakPtrFactory<DistillerJsRenderFrameObserver> weak_factory_; | 55 base::WeakPtrFactory<DistillerJsRenderFrameObserver> weak_factory_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace dom_distiller | 58 } // namespace dom_distiller |
| 59 | 59 |
| 60 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_O
BSERVER_H_ | 60 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_O
BSERVER_H_ |
| OLD | NEW |