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

Side by Side Diff: chrome/browser/ui/webui/media_router/media_router_ui.h

Issue 2558963003: Add GetCurrentRoutes() to MediaRouter API, ensure dialog has routes at init (Closed)
Patch Set: Created 4 years 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 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 <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 std::string GetTruncatedPresentationRequestSourceName() const; 133 std::string GetTruncatedPresentationRequestSourceName() const;
134 bool HasPendingRouteRequest() const { 134 bool HasPendingRouteRequest() const {
135 return current_route_request_id_ != -1; 135 return current_route_request_id_ != -1;
136 } 136 }
137 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } 137 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; }
138 const std::vector<MediaRoute>& routes() const { return routes_; } 138 const std::vector<MediaRoute>& routes() const { return routes_; }
139 const std::vector<MediaRoute::Id>& joinable_route_ids() const { 139 const std::vector<MediaRoute::Id>& joinable_route_ids() const {
140 return joinable_route_ids_; 140 return joinable_route_ids_;
141 } 141 }
142 const std::set<MediaCastMode>& cast_modes() const { return cast_modes_; } 142 const std::set<MediaCastMode>& cast_modes() const { return cast_modes_; }
143 const std::unordered_map<MediaRoute::Id, MediaCastMode>& current_cast_modes() 143 const std::unordered_map<MediaRoute::Id, MediaCastMode>&
144 const { 144 routes_and_cast_modes() const {
145 return current_cast_modes_; 145 return routes_and_cast_modes_;
146 } 146 }
147 const content::WebContents* initiator() const { return initiator_; } 147 const content::WebContents* initiator() const { return initiator_; }
148 148
149 // Marked virtual for tests. 149 // Marked virtual for tests.
150 virtual const std::string& GetRouteProviderExtensionId() const; 150 virtual const std::string& GetRouteProviderExtensionId() const;
151 151
152 // Called to track UI metrics. 152 // Called to track UI metrics.
153 void SetUIInitializationTimer(const base::Time& start_time); 153 void SetUIInitializationTimer(const base::Time& start_time);
154 void OnUIInitiallyLoaded(); 154 void OnUIInitiallyLoaded();
155 void OnUIInitialDataReceived(); 155 void OnUIInitialDataReceived();
156 156
157 void UpdateMaxDialogHeight(int height); 157 void UpdateMaxDialogHeight(int height);
158 158
159 void InitForTest(MediaRouter* router, 159 void InitForTest(MediaRouter* router,
160 content::WebContents* initiator, 160 content::WebContents* initiator,
161 MediaRouterWebUIMessageHandler* handler, 161 MediaRouterWebUIMessageHandler* handler,
162 std::unique_ptr<CreatePresentationConnectionRequest> 162 std::unique_ptr<CreatePresentationConnectionRequest>
163 create_session_request); 163 create_session_request);
164 164
165 private: 165 private:
166 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortedSinks); 166 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortedSinks);
167 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortSinksByIconType); 167 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortSinksByIconType);
168 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 168 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, FilterNonDisplayRoutes);
169 UIMediaRoutesObserverFiltersNonDisplayRoutes); 169 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, FilterNonDisplayJoinableRoutes);
170 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
171 UIMediaRoutesObserverFiltersNonDisplayJoinableRoutes);
172 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 170 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
173 UIMediaRoutesObserverAssignsCurrentCastModes); 171 UIMediaRoutesObserverAssignsCurrentCastModes);
174 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 172 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
175 UIMediaRoutesObserverSkipsUnavailableCastModes); 173 UIMediaRoutesObserverSkipsUnavailableCastModes);
176 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, GetExtensionNameExtensionPresent); 174 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, GetExtensionNameExtensionPresent);
177 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 175 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
178 GetExtensionNameEmptyWhenNotInstalled); 176 GetExtensionNameEmptyWhenNotInstalled);
179 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 177 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
180 GetExtensionNameEmptyWhenNotExtensionURL); 178 GetExtensionNameEmptyWhenNotExtensionURL);
181 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 179 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 MediaSource::Id* source_id, 263 MediaSource::Id* source_id,
266 GURL* origin, 264 GURL* origin,
267 std::vector<MediaRouteResponseCallback>* route_response_callbacks, 265 std::vector<MediaRouteResponseCallback>* route_response_callbacks,
268 base::TimeDelta* timeout, 266 base::TimeDelta* timeout,
269 bool* incognito); 267 bool* incognito);
270 268
271 // Updates the set of supported cast modes and sends the updated set to 269 // Updates the set of supported cast modes and sends the updated set to
272 // |handler_|. 270 // |handler_|.
273 void UpdateCastModes(); 271 void UpdateCastModes();
274 272
273 // Updates the routes-to-cast-modes mapping in |routes_and_cast_modes_| to
274 // match the value of |routes_|.
275 void UpdateRoutesToCastModesMapping();
276
275 // Returns the default presentation request's frame URL if there is one. 277 // Returns the default presentation request's frame URL if there is one.
276 // Otherwise returns an empty GURL. 278 // Otherwise returns an empty GURL.
277 GURL GetFrameURL() const; 279 GURL GetFrameURL() const;
278 280
279 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted 281 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted
280 // only after it has deleted |this|. 282 // only after it has deleted |this|.
281 MediaRouterWebUIMessageHandler* handler_; 283 MediaRouterWebUIMessageHandler* handler_;
282 284
283 // These are non-null while this instance is registered to receive 285 // These are non-null while this instance is registered to receive
284 // updates from them. 286 // updates from them.
(...skipping 11 matching lines...) Expand all
296 int route_request_counter_; 298 int route_request_counter_;
297 299
298 // Used for locale-aware sorting of sinks by name. Set during |InitCommon()| 300 // Used for locale-aware sorting of sinks by name. Set during |InitCommon()|
299 // using the current locale. Set to null 301 // using the current locale. Set to null
300 std::unique_ptr<icu::Collator> collator_; 302 std::unique_ptr<icu::Collator> collator_;
301 303
302 std::vector<MediaSinkWithCastModes> sinks_; 304 std::vector<MediaSinkWithCastModes> sinks_;
303 std::vector<MediaRoute> routes_; 305 std::vector<MediaRoute> routes_;
304 std::vector<MediaRoute::Id> joinable_route_ids_; 306 std::vector<MediaRoute::Id> joinable_route_ids_;
305 CastModeSet cast_modes_; 307 CastModeSet cast_modes_;
306 std::unordered_map<MediaRoute::Id, MediaCastMode> current_cast_modes_; 308 std::unordered_map<MediaRoute::Id, MediaCastMode> routes_and_cast_modes_;
307 309
308 std::unique_ptr<QueryResultManager> query_result_manager_; 310 std::unique_ptr<QueryResultManager> query_result_manager_;
309 311
310 // If set, then the result of the next presentation route request will 312 // If set, then the result of the next presentation route request will
311 // be handled by this object. 313 // be handled by this object.
312 std::unique_ptr<CreatePresentationConnectionRequest> create_session_request_; 314 std::unique_ptr<CreatePresentationConnectionRequest> create_session_request_;
313 315
314 // Set to the presentation request corresponding to the presentation cast 316 // Set to the presentation request corresponding to the presentation cast
315 // mode, if supported. Otherwise set to nullptr. 317 // mode, if supported. Otherwise set to nullptr.
316 std::unique_ptr<PresentationRequest> presentation_request_; 318 std::unique_ptr<PresentationRequest> presentation_request_;
(...skipping 19 matching lines...) Expand all
336 // NOTE: Weak pointers must be invalidated before all other member variables. 338 // NOTE: Weak pointers must be invalidated before all other member variables.
337 // Therefore |weak_factory_| must be placed at the end. 339 // Therefore |weak_factory_| must be placed at the end.
338 base::WeakPtrFactory<MediaRouterUI> weak_factory_; 340 base::WeakPtrFactory<MediaRouterUI> weak_factory_;
339 341
340 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); 342 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI);
341 }; 343 };
342 344
343 } // namespace media_router 345 } // namespace media_router
344 346
345 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ 347 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698