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

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

Issue 2540773005: Add GetCurrentRoutes() to MediaRouter API, ensure dialog has routes at init (Closed)
Patch Set: Address Mark's comment 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 std::string GetTruncatedPresentationRequestSourceName() const; 139 std::string GetTruncatedPresentationRequestSourceName() const;
140 bool HasPendingRouteRequest() const { 140 bool HasPendingRouteRequest() const {
141 return current_route_request_id_ != -1; 141 return current_route_request_id_ != -1;
142 } 142 }
143 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } 143 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; }
144 const std::vector<MediaRoute>& routes() const { return routes_; } 144 const std::vector<MediaRoute>& routes() const { return routes_; }
145 const std::vector<MediaRoute::Id>& joinable_route_ids() const { 145 const std::vector<MediaRoute::Id>& joinable_route_ids() const {
146 return joinable_route_ids_; 146 return joinable_route_ids_;
147 } 147 }
148 const std::set<MediaCastMode>& cast_modes() const { return cast_modes_; } 148 const std::set<MediaCastMode>& cast_modes() const { return cast_modes_; }
149 const std::unordered_map<MediaRoute::Id, MediaCastMode>& current_cast_modes() 149 const std::unordered_map<MediaRoute::Id, MediaCastMode>&
150 const { 150 routes_and_cast_modes() const {
151 return current_cast_modes_; 151 return routes_and_cast_modes_;
152 } 152 }
153 const content::WebContents* initiator() const { return initiator_; } 153 const content::WebContents* initiator() const { return initiator_; }
154 154
155 // Marked virtual for tests. 155 // Marked virtual for tests.
156 virtual const std::string& GetRouteProviderExtensionId() const; 156 virtual const std::string& GetRouteProviderExtensionId() const;
157 157
158 // Called to track UI metrics. 158 // Called to track UI metrics.
159 void SetUIInitializationTimer(const base::Time& start_time); 159 void SetUIInitializationTimer(const base::Time& start_time);
160 void OnUIInitiallyLoaded(); 160 void OnUIInitiallyLoaded();
161 void OnUIInitialDataReceived(); 161 void OnUIInitialDataReceived();
162 162
163 void UpdateMaxDialogHeight(int height); 163 void UpdateMaxDialogHeight(int height);
164 164
165 void InitForTest(MediaRouter* router, 165 void InitForTest(MediaRouter* router,
166 content::WebContents* initiator, 166 content::WebContents* initiator,
167 MediaRouterWebUIMessageHandler* handler, 167 MediaRouterWebUIMessageHandler* handler,
168 std::unique_ptr<CreatePresentationConnectionRequest> 168 std::unique_ptr<CreatePresentationConnectionRequest>
169 create_session_request); 169 create_session_request);
170 170
171 private: 171 private:
172 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortedSinks); 172 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortedSinks);
173 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortSinksByIconType); 173 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, SortSinksByIconType);
174 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 174 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, FilterNonDisplayRoutes);
175 UIMediaRoutesObserverFiltersNonDisplayRoutes); 175 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, FilterNonDisplayJoinableRoutes);
176 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
177 UIMediaRoutesObserverFiltersNonDisplayJoinableRoutes);
178 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 176 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
179 UIMediaRoutesObserverAssignsCurrentCastModes); 177 UIMediaRoutesObserverAssignsCurrentCastModes);
180 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 178 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
181 UIMediaRoutesObserverSkipsUnavailableCastModes); 179 UIMediaRoutesObserverSkipsUnavailableCastModes);
182 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, GetExtensionNameExtensionPresent); 180 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, GetExtensionNameExtensionPresent);
183 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 181 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
184 GetExtensionNameEmptyWhenNotInstalled); 182 GetExtensionNameEmptyWhenNotInstalled);
185 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 183 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
186 GetExtensionNameEmptyWhenNotExtensionURL); 184 GetExtensionNameEmptyWhenNotExtensionURL);
187 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, 185 FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 MediaSource::Id* source_id, 269 MediaSource::Id* source_id,
272 GURL* origin, 270 GURL* origin,
273 std::vector<MediaRouteResponseCallback>* route_response_callbacks, 271 std::vector<MediaRouteResponseCallback>* route_response_callbacks,
274 base::TimeDelta* timeout, 272 base::TimeDelta* timeout,
275 bool* incognito); 273 bool* incognito);
276 274
277 // Updates the set of supported cast modes and sends the updated set to 275 // Updates the set of supported cast modes and sends the updated set to
278 // |handler_|. 276 // |handler_|.
279 void UpdateCastModes(); 277 void UpdateCastModes();
280 278
279 // Updates the routes-to-cast-modes mapping in |routes_and_cast_modes_| to
280 // match the value of |routes_|.
281 void UpdateRoutesToCastModesMapping();
282
281 // Returns the default presentation request's frame URL if there is one. 283 // Returns the default presentation request's frame URL if there is one.
282 // Otherwise returns an empty GURL. 284 // Otherwise returns an empty GURL.
283 GURL GetFrameURL() const; 285 GURL GetFrameURL() const;
284 286
285 // Returns the serialized origin for |initiator_|, or the serialization of an 287 // Returns the serialized origin for |initiator_|, or the serialization of an
286 // opaque origin ("null") if |initiator_| is not set. 288 // opaque origin ("null") if |initiator_| is not set.
287 std::string GetSerializedInitiatorOrigin() const; 289 std::string GetSerializedInitiatorOrigin() const;
288 290
289 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted 291 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted
290 // only after it has deleted |this|. 292 // only after it has deleted |this|.
(...skipping 15 matching lines...) Expand all
306 int route_request_counter_; 308 int route_request_counter_;
307 309
308 // Used for locale-aware sorting of sinks by name. Set during |InitCommon()| 310 // Used for locale-aware sorting of sinks by name. Set during |InitCommon()|
309 // using the current locale. Set to null 311 // using the current locale. Set to null
310 std::unique_ptr<icu::Collator> collator_; 312 std::unique_ptr<icu::Collator> collator_;
311 313
312 std::vector<MediaSinkWithCastModes> sinks_; 314 std::vector<MediaSinkWithCastModes> sinks_;
313 std::vector<MediaRoute> routes_; 315 std::vector<MediaRoute> routes_;
314 std::vector<MediaRoute::Id> joinable_route_ids_; 316 std::vector<MediaRoute::Id> joinable_route_ids_;
315 CastModeSet cast_modes_; 317 CastModeSet cast_modes_;
316 std::unordered_map<MediaRoute::Id, MediaCastMode> current_cast_modes_; 318 std::unordered_map<MediaRoute::Id, MediaCastMode> routes_and_cast_modes_;
317 319
318 std::unique_ptr<QueryResultManager> query_result_manager_; 320 std::unique_ptr<QueryResultManager> query_result_manager_;
319 321
320 // If set, then the result of the next presentation route request will 322 // If set, then the result of the next presentation route request will
321 // be handled by this object. 323 // be handled by this object.
322 std::unique_ptr<CreatePresentationConnectionRequest> create_session_request_; 324 std::unique_ptr<CreatePresentationConnectionRequest> create_session_request_;
323 325
324 // Set to the presentation request corresponding to the presentation cast 326 // Set to the presentation request corresponding to the presentation cast
325 // mode, if supported. Otherwise set to nullptr. 327 // mode, if supported. Otherwise set to nullptr.
326 std::unique_ptr<PresentationRequest> presentation_request_; 328 std::unique_ptr<PresentationRequest> presentation_request_;
(...skipping 19 matching lines...) Expand all
346 // NOTE: Weak pointers must be invalidated before all other member variables. 348 // NOTE: Weak pointers must be invalidated before all other member variables.
347 // Therefore |weak_factory_| must be placed at the end. 349 // Therefore |weak_factory_| must be placed at the end.
348 base::WeakPtrFactory<MediaRouterUI> weak_factory_; 350 base::WeakPtrFactory<MediaRouterUI> weak_factory_;
349 351
350 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); 352 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI);
351 }; 353 };
352 354
353 } // namespace media_router 355 } // namespace media_router
354 356
355 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ 357 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/router/mock_media_router.h ('k') | chrome/browser/ui/webui/media_router/media_router_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698