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

Side by Side Diff: content/browser/presentation/presentation_service_impl.h

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 years, 7 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 CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
23 #include "content/public/browser/navigation_details.h" 23 #include "content/public/browser/navigation_details.h"
24 #include "content/public/browser/presentation_screen_availability_listener.h" 24 #include "content/public/browser/presentation_screen_availability_listener.h"
25 #include "content/public/browser/presentation_service_delegate.h" 25 #include "content/public/browser/presentation_service_delegate.h"
26 #include "content/public/browser/web_contents_observer.h" 26 #include "content/public/browser/web_contents_observer.h"
27 #include "content/public/common/frame_navigate_params.h" 27 #include "content/public/common/frame_navigate_params.h"
28 #include "mojo/public/cpp/bindings/binding.h" 28 #include "mojo/public/cpp/bindings/binding.h"
29 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" 29 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h"
30 #include "url/gurl.h" 30 #include "url/gurl.h"
31 31
32 namespace service_manager {
33 struct BindSourceInfo;
34 }
35
32 namespace content { 36 namespace content {
33 37
34 struct PresentationConnectionMessage; 38 struct PresentationConnectionMessage;
35 class RenderFrameHost; 39 class RenderFrameHost;
36 40
37 // Implementation of Mojo PresentationService. 41 // Implementation of Mojo PresentationService.
38 // It handles Presentation API requests coming from Blink / renderer process 42 // It handles Presentation API requests coming from Blink / renderer process
39 // and delegates the requests to the embedder's media router via 43 // and delegates the requests to the embedder's media router via
40 // PresentationServiceDelegate. 44 // PresentationServiceDelegate.
41 // An instance of this class tied to a RenderFrameHost and listens to events 45 // An instance of this class tied to a RenderFrameHost and listens to events
42 // related to the RFH via implementing WebContentsObserver. 46 // related to the RFH via implementing WebContentsObserver.
43 // This class is instantiated on-demand via Mojo's ConnectToRemoteService 47 // This class is instantiated on-demand via Mojo's ConnectToRemoteService
44 // from the renderer when the first presentation API request is handled. 48 // from the renderer when the first presentation API request is handled.
45 class CONTENT_EXPORT PresentationServiceImpl 49 class CONTENT_EXPORT PresentationServiceImpl
46 : public NON_EXPORTED_BASE(blink::mojom::PresentationService), 50 : public NON_EXPORTED_BASE(blink::mojom::PresentationService),
47 public WebContentsObserver, 51 public WebContentsObserver,
48 public PresentationServiceDelegate::Observer { 52 public PresentationServiceDelegate::Observer {
49 public: 53 public:
50 ~PresentationServiceImpl() override; 54 ~PresentationServiceImpl() override;
51 55
52 using NewPresentationCallback = 56 using NewPresentationCallback =
53 base::Callback<void(const base::Optional<PresentationInfo>&, 57 base::Callback<void(const base::Optional<PresentationInfo>&,
54 const base::Optional<PresentationError>&)>; 58 const base::Optional<PresentationError>&)>;
55 59
56 // Static factory method to create an instance of PresentationServiceImpl. 60 // Static factory method to create an instance of PresentationServiceImpl.
57 // |render_frame_host|: The RFH the instance is associated with. 61 // |render_frame_host|: The RFH the instance is associated with.
58 // |request|: The instance will be bound to this request. Used for Mojo setup. 62 // |request|: The instance will be bound to this request. Used for Mojo setup.
59 static void CreateMojoService( 63 static void CreateMojoService(
60 RenderFrameHost* render_frame_host, 64 RenderFrameHost* render_frame_host,
65 const service_manager::BindSourceInfo& source_info,
61 mojo::InterfaceRequest<blink::mojom::PresentationService> request); 66 mojo::InterfaceRequest<blink::mojom::PresentationService> request);
62 67
63 private: 68 private:
64 friend class PresentationServiceImplTest; 69 friend class PresentationServiceImplTest;
65 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, Reset); 70 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, Reset);
66 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, DidNavigateThisFrame); 71 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, DidNavigateThisFrame);
67 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 72 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
68 DidNavigateOtherFrame); 73 DidNavigateOtherFrame);
69 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, ThisRenderFrameDeleted); 74 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, ThisRenderFrameDeleted);
70 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 75 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const std::string& presentation_id) override; 177 const std::string& presentation_id) override;
173 void ListenForConnectionMessages( 178 void ListenForConnectionMessages(
174 const PresentationInfo& presentation_info) override; 179 const PresentationInfo& presentation_info) override;
175 void SetPresentationConnection( 180 void SetPresentationConnection(
176 const PresentationInfo& presentation_info, 181 const PresentationInfo& presentation_info,
177 blink::mojom::PresentationConnectionPtr controller_connection_ptr, 182 blink::mojom::PresentationConnectionPtr controller_connection_ptr,
178 blink::mojom::PresentationConnectionRequest receiver_connection_request) 183 blink::mojom::PresentationConnectionRequest receiver_connection_request)
179 override; 184 override;
180 185
181 // Creates a binding between this object and |request|. 186 // Creates a binding between this object and |request|.
182 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request); 187 void Bind(blink::mojom::PresentationServiceRequest request);
183 188
184 // WebContentsObserver override. 189 // WebContentsObserver override.
185 void DidFinishNavigation(NavigationHandle* navigation_handle) override; 190 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
186 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; 191 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
187 void WebContentsDestroyed() override; 192 void WebContentsDestroyed() override;
188 193
189 // PresentationServiceDelegate::Observer 194 // PresentationServiceDelegate::Observer
190 void OnDelegateDestroyed() override; 195 void OnDelegateDestroyed() override;
191 196
192 // Passed to embedder's implementation of PresentationServiceDelegate for 197 // Passed to embedder's implementation of PresentationServiceDelegate for
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 302
298 // NOTE: Weak pointers must be invalidated before all other member variables. 303 // NOTE: Weak pointers must be invalidated before all other member variables.
299 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; 304 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_;
300 305
301 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); 306 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl);
302 }; 307 };
303 308
304 } // namespace content 309 } // namespace content
305 310
306 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 311 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/permissions/permission_service_context.cc ('k') | content/browser/presentation/presentation_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698