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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "components/dom_distiller/content/common/distiller_page_notifier_servic
e.mojom.h" | 10 #include "components/dom_distiller/content/common/distiller_page_notifier_servic
e.mojom.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 "mojo/public/cpp/bindings/strong_binding.h" |
13 #include "services/shell/public/cpp/interface_registry.h" | 14 #include "services/shell/public/cpp/interface_registry.h" |
14 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
15 | 16 |
16 namespace dom_distiller { | 17 namespace dom_distiller { |
17 | 18 |
18 DistillerJsRenderFrameObserver::DistillerJsRenderFrameObserver( | 19 DistillerJsRenderFrameObserver::DistillerJsRenderFrameObserver( |
19 content::RenderFrame* render_frame, | 20 content::RenderFrame* render_frame, |
20 const int distiller_isolated_world_id) | 21 const int distiller_isolated_world_id) |
21 : RenderFrameObserver(render_frame), | 22 : RenderFrameObserver(render_frame), |
22 distiller_isolated_world_id_(distiller_isolated_world_id), | 23 distiller_isolated_world_id_(distiller_isolated_world_id), |
(...skipping 29 matching lines...) Expand all Loading... |
52 } | 53 } |
53 | 54 |
54 void DistillerJsRenderFrameObserver::RegisterMojoInterface() { | 55 void DistillerJsRenderFrameObserver::RegisterMojoInterface() { |
55 render_frame()->GetInterfaceRegistry()->AddInterface(base::Bind( | 56 render_frame()->GetInterfaceRegistry()->AddInterface(base::Bind( |
56 &DistillerJsRenderFrameObserver::CreateDistillerPageNotifierService, | 57 &DistillerJsRenderFrameObserver::CreateDistillerPageNotifierService, |
57 weak_factory_.GetWeakPtr())); | 58 weak_factory_.GetWeakPtr())); |
58 } | 59 } |
59 | 60 |
60 void DistillerJsRenderFrameObserver::CreateDistillerPageNotifierService( | 61 void DistillerJsRenderFrameObserver::CreateDistillerPageNotifierService( |
61 mojo::InterfaceRequest<mojom::DistillerPageNotifierService> request) { | 62 mojo::InterfaceRequest<mojom::DistillerPageNotifierService> request) { |
62 // This is strongly bound to and owned by the pipe. | 63 mojo::MakeStrongBinding( |
63 new DistillerPageNotifierServiceImpl(this, std::move(request)); | 64 base::MakeUnique<DistillerPageNotifierServiceImpl>(this), |
| 65 std::move(request)); |
64 } | 66 } |
65 | 67 |
66 void DistillerJsRenderFrameObserver::SetIsDistillerPage() { | 68 void DistillerJsRenderFrameObserver::SetIsDistillerPage() { |
67 is_distiller_page_ = true; | 69 is_distiller_page_ = true; |
68 } | 70 } |
69 | 71 |
70 void DistillerJsRenderFrameObserver::OnDestruct() { | 72 void DistillerJsRenderFrameObserver::OnDestruct() { |
71 delete this; | 73 delete this; |
72 } | 74 } |
73 | 75 |
74 } // namespace dom_distiller | 76 } // namespace dom_distiller |
OLD | NEW |