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

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

Issue 1363593003: [Media Router] Set timeout for route creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months 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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/timer/timer.h"
16 #include "chrome/browser/media/router/issue.h" 17 #include "chrome/browser/media/router/issue.h"
17 #include "chrome/browser/media/router/media_source.h" 18 #include "chrome/browser/media/router/media_source.h"
18 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" 19 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
19 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 20 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
20 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" 21 #include "chrome/browser/ui/webui/media_router/media_cast_mode.h"
21 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" 22 #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h"
22 #include "chrome/browser/ui/webui/media_router/query_result_manager.h" 23 #include "chrome/browser/ui/webui/media_router/query_result_manager.h"
23 #include "content/public/browser/web_ui_data_source.h" 24 #include "content/public/browser/web_ui_data_source.h"
24 25
25 namespace content { 26 namespace content {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 // Callback passed to MediaRouter to receive response to route creation 170 // Callback passed to MediaRouter to receive response to route creation
170 // requests. 171 // requests.
171 void OnRouteResponseReceived(const MediaSink::Id& sink_id, 172 void OnRouteResponseReceived(const MediaSink::Id& sink_id,
172 const MediaRoute* route, 173 const MediaRoute* route,
173 const std::string& presentation_id, 174 const std::string& presentation_id,
174 const std::string& error); 175 const std::string& error);
175 176
176 bool DoCreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode); 177 bool DoCreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode);
177 178
179 // Creates and sends an issue if route creation times out.
180 void RouteCreationTimeout();
181
178 // Sets the source host name to be displayed in the UI. 182 // Sets the source host name to be displayed in the UI.
179 // Gets cast modes from |query_result_manager_| and forwards it to UI. 183 // Gets cast modes from |query_result_manager_| and forwards it to UI.
180 // One of the Init* functions must have been called before. 184 // One of the Init* functions must have been called before.
181 void UpdateSourceHostAndCastModes(const GURL& frame_url); 185 void UpdateSourceHostAndCastModes(const GURL& frame_url);
182 186
183 // Initializes the dialog with mirroring sources derived from |initiator|, 187 // Initializes the dialog with mirroring sources derived from |initiator|,
184 // and optional |default_source| and |default_frame_url| if any. 188 // and optional |default_source| and |default_frame_url| if any.
185 void InitCommon(content::WebContents* initiator, 189 void InitCommon(content::WebContents* initiator,
186 const MediaSource& default_source, 190 const MediaSource& default_source,
187 const GURL& default_frame_url); 191 const GURL& default_frame_url);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // Holding a WeakPtr to PresentationServiceDelegateImpl is the cleanest way to 229 // Holding a WeakPtr to PresentationServiceDelegateImpl is the cleanest way to
226 // handle this. 230 // handle this.
227 // TODO(imcheng): hold a weak ptr to an abstract type instead. 231 // TODO(imcheng): hold a weak ptr to an abstract type instead.
228 base::WeakPtr<PresentationServiceDelegateImpl> presentation_service_delegate_; 232 base::WeakPtr<PresentationServiceDelegateImpl> presentation_service_delegate_;
229 233
230 content::WebContents* initiator_; 234 content::WebContents* initiator_;
231 235
232 // Pointer to the MediaRouter for this instance's BrowserContext. 236 // Pointer to the MediaRouter for this instance's BrowserContext.
233 MediaRouterMojoImpl* router_; 237 MediaRouterMojoImpl* router_;
234 238
239 // Timer used to implement a timeout on a create route request.
240 base::OneShotTimer<MediaRouterUI> route_creation_timer_;
241
235 // NOTE: Weak pointers must be invalidated before all other member variables. 242 // NOTE: Weak pointers must be invalidated before all other member variables.
236 // Therefore |weak_factory_| must be placed at the end. 243 // Therefore |weak_factory_| must be placed at the end.
237 base::WeakPtrFactory<MediaRouterUI> weak_factory_; 244 base::WeakPtrFactory<MediaRouterUI> weak_factory_;
238 245
239 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); 246 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI);
240 }; 247 };
241 248
242 } // namespace media_router 249 } // namespace media_router
243 250
244 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ 251 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698