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 CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 30 matching lines...) Expand all Loading... |
41 class RouteRequestResult; | 41 class RouteRequestResult; |
42 | 42 |
43 // Implementation of PresentationServiceDelegate that interfaces an instance of | 43 // Implementation of PresentationServiceDelegate that interfaces an instance of |
44 // WebContents with the Chrome Media Router. It uses the Media Router to handle | 44 // WebContents with the Chrome Media Router. It uses the Media Router to handle |
45 // presentation API calls forwarded from PresentationServiceImpl. In addition, | 45 // presentation API calls forwarded from PresentationServiceImpl. In addition, |
46 // it also provides default presentation URL that is required for creating | 46 // it also provides default presentation URL that is required for creating |
47 // browser-initiated sessions. It is scoped to the lifetime of a WebContents, | 47 // browser-initiated sessions. It is scoped to the lifetime of a WebContents, |
48 // and is managed by the associated WebContents. | 48 // and is managed by the associated WebContents. |
49 class PresentationServiceDelegateImpl | 49 class PresentationServiceDelegateImpl |
50 : public content::WebContentsUserData<PresentationServiceDelegateImpl>, | 50 : public content::WebContentsUserData<PresentationServiceDelegateImpl>, |
51 public content::PresentationServiceDelegate { | 51 public content::ControllerPresentationServiceDelegate { |
52 public: | 52 public: |
53 // Observer interface for listening to default presentation request | 53 // Observer interface for listening to default presentation request |
54 // changes for the WebContents. | 54 // changes for the WebContents. |
55 class DefaultPresentationRequestObserver { | 55 class DefaultPresentationRequestObserver { |
56 public: | 56 public: |
57 virtual ~DefaultPresentationRequestObserver() = default; | 57 virtual ~DefaultPresentationRequestObserver() = default; |
58 | 58 |
59 // Called when default presentation request for the corresponding | 59 // Called when default presentation request for the corresponding |
60 // WebContents is set or changed. | 60 // WebContents is set or changed. |
61 // |default_presentation_info|: New default presentation request. | 61 // |default_presentation_info|: New default presentation request. |
62 virtual void OnDefaultPresentationChanged( | 62 virtual void OnDefaultPresentationChanged( |
63 const PresentationRequest& default_presentation_request) = 0; | 63 const PresentationRequest& default_presentation_request) = 0; |
64 | 64 |
65 // Called when default presentation request for the corresponding | 65 // Called when default presentation request for the corresponding |
66 // WebContents has been removed. | 66 // WebContents has been removed. |
67 virtual void OnDefaultPresentationRemoved() = 0; | 67 virtual void OnDefaultPresentationRemoved() = 0; |
68 }; | 68 }; |
69 | 69 |
70 // Retrieves the instance of PresentationServiceDelegateImpl that was attached | 70 // Retrieves the instance of PresentationServiceDelegateImpl that was attached |
71 // to the specified WebContents. If no instance was attached, creates one, | 71 // to the specified WebContents. If no instance was attached, creates one, |
72 // and attaches it to the specified WebContents. | 72 // and attaches it to the specified WebContents. |
73 static PresentationServiceDelegateImpl* GetOrCreateForWebContents( | 73 static PresentationServiceDelegateImpl* GetOrCreateForWebContents( |
74 content::WebContents* web_contents); | 74 content::WebContents* web_contents); |
75 | 75 |
76 ~PresentationServiceDelegateImpl() override; | 76 ~PresentationServiceDelegateImpl() override; |
77 | 77 |
78 // content::PresentationServiceDelegate implementation. | |
79 void AddObserver( | |
80 int render_process_id, | |
81 int render_frame_id, | |
82 content::PresentationServiceDelegate::Observer* observer) override; | |
83 void RemoveObserver(int render_process_id, int render_frame_id) override; | |
84 bool AddScreenAvailabilityListener( | 78 bool AddScreenAvailabilityListener( |
85 int render_process_id, | 79 int render_process_id, |
86 int render_frame_id, | 80 int render_frame_id, |
87 content::PresentationScreenAvailabilityListener* listener) override; | 81 content::PresentationScreenAvailabilityListener* listener) override; |
88 void RemoveScreenAvailabilityListener( | 82 void RemoveScreenAvailabilityListener( |
89 int render_process_id, | 83 int render_process_id, |
90 int render_frame_id, | 84 int render_frame_id, |
91 content::PresentationScreenAvailabilityListener* listener) override; | 85 content::PresentationScreenAvailabilityListener* listener) override; |
92 void Reset(int render_process_id, int render_frame_id) override; | 86 void Reset(int render_process_id, int render_frame_id) override; |
93 void SetDefaultPresentationUrls( | 87 void SetDefaultPresentationUrls( |
(...skipping 29 matching lines...) Expand all Loading... |
123 int render_frame_id, | 117 int render_frame_id, |
124 const content::PresentationSessionInfo& session, | 118 const content::PresentationSessionInfo& session, |
125 std::unique_ptr<content::PresentationSessionMessage> message, | 119 std::unique_ptr<content::PresentationSessionMessage> message, |
126 const SendMessageCallback& send_message_cb) override; | 120 const SendMessageCallback& send_message_cb) override; |
127 void ListenForConnectionStateChange( | 121 void ListenForConnectionStateChange( |
128 int render_process_id, | 122 int render_process_id, |
129 int render_frame_id, | 123 int render_frame_id, |
130 const content::PresentationSessionInfo& connection, | 124 const content::PresentationSessionInfo& connection, |
131 const content::PresentationConnectionStateChangedCallback& | 125 const content::PresentationConnectionStateChangedCallback& |
132 state_changed_cb) override; | 126 state_changed_cb) override; |
| 127 void ConnectToOffscreenPresentation( |
| 128 int render_process_id, |
| 129 int render_frame_id, |
| 130 const content::PresentationSessionInfo& session, |
| 131 content::PresentationConnectionPtr connection) override; |
133 | 132 |
134 // Callback invoked when a default PresentationRequest is started from a | 133 // Callback invoked when a default PresentationRequest is started from a |
135 // browser-initiated dialog. | 134 // browser-initiated dialog. |
136 void OnRouteResponse(const PresentationRequest& request, | 135 void OnRouteResponse(const PresentationRequest& request, |
137 const RouteRequestResult& result); | 136 const RouteRequestResult& result); |
138 | 137 |
139 // Adds / removes an observer for listening to default PresentationRequest | 138 // Adds / removes an observer for listening to default PresentationRequest |
140 // changes. This class does not own |observer|. When |observer| is about to | 139 // changes. This class does not own |observer|. When |observer| is about to |
141 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called. | 140 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called. |
142 void AddDefaultPresentationRequestObserver( | 141 void AddDefaultPresentationRequestObserver( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 std::unique_ptr<PresentationFrameManager> frame_manager_; | 210 std::unique_ptr<PresentationFrameManager> frame_manager_; |
212 | 211 |
213 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; | 212 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; |
214 | 213 |
215 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); | 214 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); |
216 }; | 215 }; |
217 | 216 |
218 } // namespace media_router | 217 } // namespace media_router |
219 | 218 |
220 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 219 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
OLD | NEW |