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 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_im pl.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_im pl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 MediaRouterUI* media_router_ui = | 190 MediaRouterUI* media_router_ui = |
191 static_cast<MediaRouterUI*>(web_ui->GetController()); | 191 static_cast<MediaRouterUI*>(web_ui->GetController()); |
192 if (media_router_ui) | 192 if (media_router_ui) |
193 media_router_ui->Close(); | 193 media_router_ui->Close(); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 void MediaRouterDialogControllerImpl::CreateMediaRouterDialog() { | 197 void MediaRouterDialogControllerImpl::CreateMediaRouterDialog() { |
198 DCHECK(!dialog_observer_.get()); | 198 DCHECK(!dialog_observer_.get()); |
199 | 199 |
200 base::Time dialog_creation_start_time = base::Time::Now(); | |
mark a. foltz
2015/12/09 22:20:13
dialog_creation_time?
apacible
2015/12/09 23:19:55
Done.
| |
200 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("media_router", "UI", initiator()); | 201 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("media_router", "UI", initiator()); |
201 | 202 |
202 Profile* profile = | 203 Profile* profile = |
203 Profile::FromBrowserContext(initiator()->GetBrowserContext()); | 204 Profile::FromBrowserContext(initiator()->GetBrowserContext()); |
204 DCHECK(profile); | 205 DCHECK(profile); |
205 | 206 |
206 WebDialogDelegate* web_dialog_delegate = | 207 WebDialogDelegate* web_dialog_delegate = |
207 new MediaRouterDialogDelegate(action_); | 208 new MediaRouterDialogDelegate(action_); |
208 // |web_dialog_delegate|'s owner is |constrained_delegate|. | 209 // |web_dialog_delegate|'s owner is |constrained_delegate|. |
209 // |constrained_delegate| is owned by the parent |views::View|. | 210 // |constrained_delegate| is owned by the parent |views::View|. |
(...skipping 15 matching lines...) Expand all Loading... | |
225 ConstrainedWebDialogDelegate* constrained_delegate = | 226 ConstrainedWebDialogDelegate* constrained_delegate = |
226 ShowConstrainedWebDialogWithAutoResize( | 227 ShowConstrainedWebDialogWithAutoResize( |
227 profile, web_dialog_delegate, initiator(), min_size, max_size); | 228 profile, web_dialog_delegate, initiator(), min_size, max_size); |
228 #endif | 229 #endif |
229 | 230 |
230 WebContents* media_router_dialog = constrained_delegate->GetWebContents(); | 231 WebContents* media_router_dialog = constrained_delegate->GetWebContents(); |
231 TRACE_EVENT_NESTABLE_ASYNC_INSTANT1("media_router", "UI", initiator(), | 232 TRACE_EVENT_NESTABLE_ASYNC_INSTANT1("media_router", "UI", initiator(), |
232 "WebContents created", | 233 "WebContents created", |
233 media_router_dialog); | 234 media_router_dialog); |
234 | 235 |
236 // |media_router_ui| is created when |constrained_delegate| is created. | |
237 // For tests, GetWebUI() returns a nullptr. | |
238 if (media_router_dialog->GetWebUI()) { | |
239 MediaRouterUI* media_router_ui = static_cast<MediaRouterUI*>( | |
240 media_router_dialog->GetWebUI()->GetController()); | |
241 DCHECK(media_router_ui); | |
242 media_router_ui->SetUIInitializationTimer(dialog_creation_start_time); | |
243 } | |
244 | |
235 media_router_dialog_pending_ = true; | 245 media_router_dialog_pending_ = true; |
236 | 246 |
237 dialog_observer_.reset(new DialogWebContentsObserver( | 247 dialog_observer_.reset(new DialogWebContentsObserver( |
238 media_router_dialog, this)); | 248 media_router_dialog, this)); |
239 | 249 |
240 if (action_) | 250 if (action_) |
241 action_->OnPopupShown(); | 251 action_->OnPopupShown(); |
242 } | 252 } |
243 | 253 |
244 void MediaRouterDialogControllerImpl::Reset() { | 254 void MediaRouterDialogControllerImpl::Reset() { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 ->GetWeakPtr(); | 302 ->GetWeakPtr(); |
293 if (!create_connection_request.get()) { | 303 if (!create_connection_request.get()) { |
294 media_router_ui->InitWithDefaultMediaSource(delegate); | 304 media_router_ui->InitWithDefaultMediaSource(delegate); |
295 } else { | 305 } else { |
296 media_router_ui->InitWithPresentationSessionRequest( | 306 media_router_ui->InitWithPresentationSessionRequest( |
297 initiator(), delegate, create_connection_request.Pass()); | 307 initiator(), delegate, create_connection_request.Pass()); |
298 } | 308 } |
299 } | 309 } |
300 | 310 |
301 } // namespace media_router | 311 } // namespace media_router |
OLD | NEW |