| 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 #include "components/dom_distiller/content/renderer/distiller_js_render_frame_ob
server.h" | 5 #include "components/dom_distiller/content/renderer/distiller_js_render_frame_ob
server.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/dom_distiller/content/common/distiller_page_notifier_servic
e.mojom.h" | 8 #include "components/dom_distiller/content/common/distiller_page_notifier_servic
e.mojom.h" |
| 9 #include "components/dom_distiller/content/renderer/distiller_page_notifier_serv
ice_impl.h" | 9 #include "components/dom_distiller/content/renderer/distiller_page_notifier_serv
ice_impl.h" |
| 10 #include "content/public/common/service_registry.h" | 10 #include "content/public/common/service_registry.h" |
| 11 #include "content/public/renderer/render_frame.h" | 11 #include "content/public/renderer/render_frame.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace dom_distiller { | 14 namespace dom_distiller { |
| 15 | 15 |
| 16 DistillerJsRenderFrameObserver::DistillerJsRenderFrameObserver( | 16 DistillerJsRenderFrameObserver::DistillerJsRenderFrameObserver( |
| 17 content::RenderFrame* render_frame, | 17 content::RenderFrame* render_frame, |
| 18 const int distiller_isolated_world_id) | 18 const int distiller_isolated_world_id) |
| 19 : RenderFrameObserver(render_frame), | 19 : RenderFrameObserver(render_frame), |
| 20 distiller_isolated_world_id_(distiller_isolated_world_id), | 20 distiller_isolated_world_id_(distiller_isolated_world_id), |
| 21 is_distiller_page_(false), | 21 is_distiller_page_(false), |
| 22 weak_factory_(this) {} | 22 weak_factory_(this) {} |
| 23 | 23 |
| 24 DistillerJsRenderFrameObserver::~DistillerJsRenderFrameObserver() {} | 24 DistillerJsRenderFrameObserver::~DistillerJsRenderFrameObserver() {} |
| 25 | 25 |
| 26 void DistillerJsRenderFrameObserver::DidStartProvisionalLoad() { | 26 void DistillerJsRenderFrameObserver::DidStartProvisionalLoad( |
| 27 blink::WebDataSource* datasource) { |
| 27 RegisterMojoService(); | 28 RegisterMojoService(); |
| 28 } | 29 } |
| 29 | 30 |
| 30 void DistillerJsRenderFrameObserver::DidFinishLoad() { | 31 void DistillerJsRenderFrameObserver::DidFinishLoad() { |
| 31 // If no message about the distilled page was received at this point, there | 32 // If no message about the distilled page was received at this point, there |
| 32 // will not be one; remove the DistillerPageNotifierService from the registry. | 33 // will not be one; remove the DistillerPageNotifierService from the registry. |
| 33 render_frame() | 34 render_frame() |
| 34 ->GetServiceRegistry() | 35 ->GetServiceRegistry() |
| 35 ->RemoveService<DistillerPageNotifierService>(); | 36 ->RemoveService<DistillerPageNotifierService>(); |
| 36 } | 37 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 58 mojo::InterfaceRequest<DistillerPageNotifierService> request) { | 59 mojo::InterfaceRequest<DistillerPageNotifierService> request) { |
| 59 // This is strongly bound to and owned by the pipe. | 60 // This is strongly bound to and owned by the pipe. |
| 60 new DistillerPageNotifierServiceImpl(this, request.Pass()); | 61 new DistillerPageNotifierServiceImpl(this, request.Pass()); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void DistillerJsRenderFrameObserver::SetIsDistillerPage() { | 64 void DistillerJsRenderFrameObserver::SetIsDistillerPage() { |
| 64 is_distiller_page_ = true; | 65 is_distiller_page_ = true; |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace dom_distiller | 68 } // namespace dom_distiller |
| OLD | NEW |