OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_OFFSCREEN_PRESENTATION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_OFFSCREEN_PRESENTATION_MANAGER_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_OFFSCREEN_PRESENTATION_MANAGER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_OFFSCREEN_PRESENTATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 class OffscreenPresentationManager : public KeyedService { | 82 class OffscreenPresentationManager : public KeyedService { |
83 public: | 83 public: |
84 ~OffscreenPresentationManager() override; | 84 ~OffscreenPresentationManager() override; |
85 | 85 |
86 // Register controller PSImpl to presentation with |presentation_id|, | 86 // Register controller PSImpl to presentation with |presentation_id|, |
87 // |render_frame_id|. | 87 // |render_frame_id|. |
88 // Create a new presentation if no presentation with |presentation_id| exists. | 88 // Create a new presentation if no presentation with |presentation_id| exists. |
89 // |controller| Not owned by this class. | 89 // |controller| Not owned by this class. |
90 void RegisterOffscreenPresentationController( | 90 void RegisterOffscreenPresentationController( |
91 const std::string& presentation_id, | 91 const std::string& presentation_id, |
| 92 const std::string& presentation_url, |
92 int render_frame_id, | 93 int render_frame_id, |
93 content::OffscreenPresentationClient* controller); | 94 content::OffscreenPresentationClient* controller); |
94 | 95 |
95 // Unregister controller PSImpl to presentation with |presentation_id|, | 96 // Unregister controller PSImpl to presentation with |presentation_id|, |
96 // |render_frame_id|. | 97 // |render_frame_id|. |
97 void UnregisterOffscreenPresentationController( | 98 void UnregisterOffscreenPresentationController( |
98 const std::string& presentation_id, | 99 const std::string& presentation_id, |
99 int render_frame_id); | 100 int render_frame_id); |
100 | 101 |
101 // Register receiver PSImpl to presentation with |presentation_id|. | 102 // Register receiver PSImpl to presentation with |presentation_id|. |
(...skipping 19 matching lines...) Expand all Loading... |
121 }; | 122 }; |
122 | 123 |
123 // Represents an offscreen presentation registered with | 124 // Represents an offscreen presentation registered with |
124 // OffscreenPresentationManager. | 125 // OffscreenPresentationManager. |
125 // Contains callback to the receiver to inform it of new sessions | 126 // Contains callback to the receiver to inform it of new sessions |
126 // established from a controller. | 127 // established from a controller. |
127 // Contains set of controllers registered to OffscreenPresentationManager | 128 // Contains set of controllers registered to OffscreenPresentationManager |
128 // before corresponding receiver. | 129 // before corresponding receiver. |
129 class OffscreenPresentation { | 130 class OffscreenPresentation { |
130 public: | 131 public: |
131 explicit OffscreenPresentation(const std::string& presentation_id); | 132 explicit OffscreenPresentation(const std::string& presentation_id, |
| 133 const std::string& presentation_url); |
132 ~OffscreenPresentation(); | 134 ~OffscreenPresentation(); |
133 | 135 |
134 void RegisterController(int render_frame_id, | 136 void RegisterController(int render_frame_id, |
135 content::OffscreenPresentationClient* controller); | 137 content::OffscreenPresentationClient* controller); |
136 | 138 |
137 void UnregisterController(int render_frame_id); | 139 void UnregisterController(int render_frame_id); |
138 | 140 |
139 void RegisterReceiver( | 141 void RegisterReceiver( |
140 const content::ReceiverConnectionAvailableCallback& receiver_callback); | 142 const content::ReceiverConnectionAvailableCallback& receiver_callback); |
141 | 143 |
142 private: | 144 private: |
143 friend class OffscreenPresentationManagerTest; | 145 friend class OffscreenPresentationManagerTest; |
144 friend class OffscreenPresentationManager; | 146 friend class OffscreenPresentationManager; |
145 | 147 |
| 148 // presentation_id for current presentation |
| 149 const std::string presentation_id_; |
| 150 |
146 // URL for current presentation | 151 // URL for current presentation |
147 const std::string presentation_url_; | 152 const std::string presentation_url_; |
148 | 153 |
149 // presentation_id for current presentation | |
150 const std::string presentation_id_; | |
151 | |
152 // proxy to receiver PSImpl | 154 // proxy to receiver PSImpl |
153 content::ReceiverConnectionAvailableCallback receiver_callback_; | 155 content::ReceiverConnectionAvailableCallback receiver_callback_; |
154 | 156 |
155 // proxy to controller PSImpl | 157 // proxy to controller PSImpl |
156 // It only contains controllers registered before receiver_callback_ | 158 // It only contains controllers registered before receiver_callback_ |
157 // is set. This map will be cleared in RegisterReceiver(). | 159 // is set. This map will be cleared in RegisterReceiver(). |
158 std::map<int, content::OffscreenPresentationClient*> controllers_; | 160 std::map<int, content::OffscreenPresentationClient*> controllers_; |
159 | 161 |
160 DISALLOW_COPY_AND_ASSIGN(OffscreenPresentation); | 162 DISALLOW_COPY_AND_ASSIGN(OffscreenPresentation); |
161 }; | 163 }; |
162 | 164 |
163 } // namespace media_router | 165 } // namespace media_router |
164 | 166 |
165 #endif // CHROME_BROWSER_MEDIA_ROUTER_OFFSCREEN_PRESENTATION_MANAGER_H_ | 167 #endif // CHROME_BROWSER_MEDIA_ROUTER_OFFSCREEN_PRESENTATION_MANAGER_H_ |
OLD | NEW |