Chromium Code Reviews| Index: chrome/browser/ui/webui/media_router/media_router_ui.h |
| diff --git a/chrome/browser/ui/webui/media_router/media_router_ui.h b/chrome/browser/ui/webui/media_router/media_router_ui.h |
| index 2cf09cd26be3e3e725922d815f11da31b5cfc480..442594aca086e4513e9263f41e94d0aac0ba759a 100644 |
| --- a/chrome/browser/ui/webui/media_router/media_router_ui.h |
| +++ b/chrome/browser/ui/webui/media_router/media_router_ui.h |
| @@ -13,6 +13,7 @@ |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/timer/timer.h" |
| #include "chrome/browser/media/router/issue.h" |
| #include "chrome/browser/media/router/media_source.h" |
| #include "chrome/browser/media/router/presentation_service_delegate_impl.h" |
| @@ -121,7 +122,7 @@ class MediaRouterUI |
| // Returns the hostname of the default source's parent frame URL. |
| std::string GetFrameURLHost() const; |
| - bool has_pending_route_request() const { return has_pending_route_request_; } |
| + bool HasPendingRouteRequest() const { return !expected_route_guid_.empty(); } |
| const GURL& frame_url() const { return frame_url_; } |
| const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } |
| const std::vector<MediaRoute>& routes() const { return routes_; } |
| @@ -169,12 +170,16 @@ class MediaRouterUI |
| // Callback passed to MediaRouter to receive response to route creation |
| // requests. |
| void OnRouteResponseReceived(const MediaSink::Id& sink_id, |
| + const std::string& route_guid, |
|
imcheng
2015/10/02 21:57:30
s/route_guid/route_request_id. I would also put th
apacible
2015/10/02 23:45:17
Done.
|
| const MediaRoute* route, |
| const std::string& presentation_id, |
| const std::string& error); |
| bool DoCreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode); |
| + // Creates and sends an issue if route creation times out. |
| + void RouteCreationTimeout(); |
| + |
| // Sets the source host name to be displayed in the UI. |
| // Gets cast modes from |query_result_manager_| and forwards it to UI. |
| // One of the Init* functions must have been called before. |
| @@ -202,11 +207,14 @@ class MediaRouterUI |
| // Set to true by |handler_| when the UI has been initialized. |
| bool ui_initialized_; |
| - // Set to |true| if there is a pending route request for this UI. |
| - bool has_pending_route_request_; |
| - |
| bool requesting_route_for_default_source_; |
| + // Set to a random GUID when expecting a route creation, or empty otherwise. |
|
imcheng
2015/10/02 21:57:30
suggestion: Set to non-empty if tracking a pending
apacible
2015/10/02 23:45:17
Done.
|
| + // It's possible for a route request to time out in Media Router, then the |
|
imcheng
2015/10/02 21:57:30
not sure if this comment is needed. Remove?
apacible
2015/10/02 23:45:17
Done.
|
| + // provider sends a delayed route creation response. We check the GUIDs to |
| + // determine if any action should be taken. |
| + std::string expected_route_guid_; |
|
imcheng
2015/10/02 21:57:30
I would just name this current_route_request_id_.
apacible
2015/10/02 23:45:17
Renamed. Switched to sequential counter.
|
| + |
| std::vector<MediaSinkWithCastModes> sinks_; |
| std::vector<MediaRoute> routes_; |
| CastModeSet cast_modes_; |
| @@ -232,6 +240,9 @@ class MediaRouterUI |
| // Pointer to the MediaRouter for this instance's BrowserContext. |
| MediaRouterMojoImpl* router_; |
| + // Timer used to implement a timeout on a create route request. |
| + base::OneShotTimer route_creation_timer_; |
| + |
| // NOTE: Weak pointers must be invalidated before all other member variables. |
| // Therefore |weak_factory_| must be placed at the end. |
| base::WeakPtrFactory<MediaRouterUI> weak_factory_; |