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_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 // Returns the hostname of the default source's parent frame URL. | 119 // Returns the hostname of the default source's parent frame URL. |
120 std::string GetFrameURLHost() const; | 120 std::string GetFrameURLHost() const; |
121 bool has_pending_route_request() const { return has_pending_route_request_; } | 121 bool has_pending_route_request() const { return has_pending_route_request_; } |
122 const GURL& frame_url() const { return frame_url_; } | 122 const GURL& frame_url() const { return frame_url_; } |
123 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } | 123 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } |
124 const std::vector<MediaRoute>& routes() const { return routes_; } | 124 const std::vector<MediaRoute>& routes() const { return routes_; } |
125 const std::set<MediaCastMode>& cast_modes() const { return cast_modes_; } | 125 const std::set<MediaCastMode>& cast_modes() const { return cast_modes_; } |
126 const content::WebContents* initiator() const { return initiator_; } | 126 const content::WebContents* initiator() const { return initiator_; } |
127 | 127 |
128 const std::string& GetRouteProviderExtensionId() const; | 128 const std::string& GetRouteProviderExtensionId() const; |
129 const std::set<MediaSink::Id>& GetSinkIdsInLaunch() const; | |
129 | 130 |
130 private: | 131 private: |
131 class UIIssuesObserver; | 132 class UIIssuesObserver; |
132 class UIMediaRoutesObserver; | 133 class UIMediaRoutesObserver; |
133 | 134 |
134 // QueryResultManager::Observer | 135 // QueryResultManager::Observer |
135 void OnResultsUpdated( | 136 void OnResultsUpdated( |
136 const std::vector<MediaSinkWithCastModes>& sinks) override; | 137 const std::vector<MediaSinkWithCastModes>& sinks) override; |
137 | 138 |
138 // Called by |issues_observer_| when the top issue has changed. | 139 // Called by |issues_observer_| when the top issue has changed. |
139 // If the UI is already initialized, notifies |handler_| to update the UI. | 140 // If the UI is already initialized, notifies |handler_| to update the UI. |
140 // Ignored if the UI is not yet initialized. | 141 // Ignored if the UI is not yet initialized. |
141 void SetIssue(const Issue* issue); | 142 void SetIssue(const Issue* issue); |
142 | 143 |
143 // Called by |routes_observer_| when the set of active routes has changed. | 144 // Called by |routes_observer_| when the set of active routes has changed. |
144 void OnRoutesUpdated(const std::vector<MediaRoute>& routes); | 145 void OnRoutesUpdated(const std::vector<MediaRoute>& routes); |
145 | 146 |
146 // Callback passed to MediaRouter to receive response to route creation | 147 // Callback passed to MediaRouter to receive response to route creation |
147 // requests. | 148 // requests. |
148 void OnRouteResponseReceived(const MediaRoute* route, | 149 void OnRouteResponseReceived(const MediaSink::Id& sink_id, |
150 const MediaRoute* route, | |
149 const std::string& error); | 151 const std::string& error); |
150 | 152 |
151 bool DoCreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode); | 153 bool DoCreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode); |
152 | 154 |
153 // Sets the source host name to be displayed in the UI. | 155 // Sets the source host name to be displayed in the UI. |
154 // Gets cast modes from |query_result_manager_| and forwards it to UI. | 156 // Gets cast modes from |query_result_manager_| and forwards it to UI. |
155 // One of the Init* functions must have been called before. | 157 // One of the Init* functions must have been called before. |
156 void UpdateSourceHostAndCastModes(const GURL& frame_url); | 158 void UpdateSourceHostAndCastModes(const GURL& frame_url); |
157 | 159 |
158 // Initializes the dialog with mirroring sources derived from |initiator|, | 160 // Initializes the dialog with mirroring sources derived from |initiator|, |
(...skipping 16 matching lines...) Expand all Loading... | |
175 scoped_ptr<MediaRoutesObserver> routes_observer_; | 177 scoped_ptr<MediaRoutesObserver> routes_observer_; |
176 | 178 |
177 // Set to true by |handler_| when the UI has been initialized. | 179 // Set to true by |handler_| when the UI has been initialized. |
178 bool ui_initialized_; | 180 bool ui_initialized_; |
179 | 181 |
180 // Set to |true| if there is a pending route request for this UI. | 182 // Set to |true| if there is a pending route request for this UI. |
181 bool has_pending_route_request_; | 183 bool has_pending_route_request_; |
182 | 184 |
183 bool requesting_route_for_default_source_; | 185 bool requesting_route_for_default_source_; |
184 | 186 |
185 std::vector<MediaSinkWithCastModes> sinks_; | 187 std::vector<MediaSinkWithCastModes> sinks_; |
Kevin M
2015/08/08 00:35:56
Can you put the "is launching" state here?
Or as
haibinlu
2015/08/08 01:25:38
sinks_ was overwritten when extension updates the
| |
186 std::vector<MediaRoute> routes_; | 188 std::vector<MediaRoute> routes_; |
187 CastModeSet cast_modes_; | 189 CastModeSet cast_modes_; |
188 GURL frame_url_; | 190 GURL frame_url_; |
189 | 191 |
190 scoped_ptr<QueryResultManager> query_result_manager_; | 192 scoped_ptr<QueryResultManager> query_result_manager_; |
191 | 193 |
192 // If set, then the result of the next presentation route request will | 194 // If set, then the result of the next presentation route request will |
193 // be handled by this object. | 195 // be handled by this object. |
194 scoped_ptr<CreatePresentationSessionRequest> presentation_request_; | 196 scoped_ptr<CreatePresentationSessionRequest> presentation_request_; |
195 | 197 |
(...skipping 14 matching lines...) Expand all Loading... | |
210 // NOTE: Weak pointers must be invalidated before all other member variables. | 212 // NOTE: Weak pointers must be invalidated before all other member variables. |
211 // Therefore |weak_factory_| must be placed at the end. | 213 // Therefore |weak_factory_| must be placed at the end. |
212 base::WeakPtrFactory<MediaRouterUI> weak_factory_; | 214 base::WeakPtrFactory<MediaRouterUI> weak_factory_; |
213 | 215 |
214 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); | 216 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); |
215 }; | 217 }; |
216 | 218 |
217 } // namespace media_router | 219 } // namespace media_router |
218 | 220 |
219 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ | 221 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ |
OLD | NEW |