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

Side by Side Diff: components/dom_distiller/content/browser/distiller_javascript_service_impl.h

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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
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_BROWSER_DISTILLER_JAVASCRIPT_SERVICE_IM PL_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLER_JAVASCRIPT_SERVICE_IM PL_H_
6 #define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLER_JAVASCRIPT_SERVICE_IM PL_H_ 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLER_JAVASCRIPT_SERVICE_IM PL_H_
7 7
8 #include "base/macros.h"
8 #include "components/dom_distiller/content/browser/distiller_ui_handle.h" 9 #include "components/dom_distiller/content/browser/distiller_ui_handle.h"
9 #include "components/dom_distiller/content/common/distiller_javascript_service.m ojom.h" 10 #include "components/dom_distiller/content/common/distiller_javascript_service.m ojom.h"
10 #include "mojo/public/cpp/bindings/string.h" 11 #include "mojo/public/cpp/bindings/string.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
12 13
13 namespace dom_distiller { 14 namespace dom_distiller {
14 15
15 // This is the receiving end of "distiller" JavaScript object calls. 16 // This is the receiving end of "distiller" JavaScript object calls.
16 class DistillerJavaScriptServiceImpl 17 class DistillerJavaScriptServiceImpl
17 : public mojom::DistillerJavaScriptService { 18 : public mojom::DistillerJavaScriptService {
18 public: 19 public:
19 DistillerJavaScriptServiceImpl( 20 DistillerJavaScriptServiceImpl(content::RenderFrameHost* render_frame_host,
20 content::RenderFrameHost* render_frame_host, 21 DistillerUIHandle* distiller_ui_handle);
21 DistillerUIHandle* distiller_ui_handle,
22 mojo::InterfaceRequest<mojom::DistillerJavaScriptService> request);
23 ~DistillerJavaScriptServiceImpl() override; 22 ~DistillerJavaScriptServiceImpl() override;
24 23
25 // Mojo mojom::DistillerJavaScriptService implementation. 24 // Mojo mojom::DistillerJavaScriptService implementation.
26 25
27 // Echo implementation, this call does not actually return as it would be 26 // Echo implementation, this call does not actually return as it would be
28 // blocking. 27 // blocking.
29 void HandleDistillerEchoCall(const mojo::String& message) override; 28 void HandleDistillerEchoCall(const mojo::String& message) override;
30 29
31 // Send UMA feedback and start the external feedback reporter if one exists. 30 // Send UMA feedback and start the external feedback reporter if one exists.
32 void HandleDistillerFeedbackCall(bool good) override; 31 void HandleDistillerFeedbackCall(bool good) override;
33 32
34 // Make a call into Android to close the overlay panel containing reader mode. 33 // Make a call into Android to close the overlay panel containing reader mode.
35 void HandleDistillerClosePanelCall(bool animate) override; 34 void HandleDistillerClosePanelCall(bool animate) override;
36 35
37 // Show the Android view containing Reader Mode settings. 36 // Show the Android view containing Reader Mode settings.
38 void HandleDistillerOpenSettingsCall() override; 37 void HandleDistillerOpenSettingsCall() override;
39 38
40 private: 39 private:
41 mojo::StrongBinding<mojom::DistillerJavaScriptService> binding_;
42 content::RenderFrameHost* render_frame_host_; 40 content::RenderFrameHost* render_frame_host_;
43 DistillerUIHandle* distiller_ui_handle_; 41 DistillerUIHandle* distiller_ui_handle_;
42
43 DISALLOW_COPY_AND_ASSIGN(DistillerJavaScriptServiceImpl);
44 }; 44 };
45 45
46 // static 46 // static
47 void CreateDistillerJavaScriptService( 47 void CreateDistillerJavaScriptService(
48 content::RenderFrameHost* render_frame_host, 48 content::RenderFrameHost* render_frame_host,
49 DistillerUIHandle* distiller_ui_handle, 49 DistillerUIHandle* distiller_ui_handle,
50 mojo::InterfaceRequest<mojom::DistillerJavaScriptService> request); 50 mojo::InterfaceRequest<mojom::DistillerJavaScriptService> request);
51 51
52 } // namespace dom_distiller 52 } // namespace dom_distiller
53 53
54 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLER_JAVASCRIPT_SERVICE _IMPL_H_ 54 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLER_JAVASCRIPT_SERVICE _IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698