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_ui.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 : ConstrainedWebDialogUI(web_ui), | 163 : ConstrainedWebDialogUI(web_ui), |
164 handler_(new MediaRouterWebUIMessageHandler(this)), | 164 handler_(new MediaRouterWebUIMessageHandler(this)), |
165 ui_initialized_(false), | 165 ui_initialized_(false), |
166 current_route_request_id_(-1), | 166 current_route_request_id_(-1), |
167 route_request_counter_(0), | 167 route_request_counter_(0), |
168 initiator_(nullptr), | 168 initiator_(nullptr), |
169 router_(nullptr), | 169 router_(nullptr), |
170 weak_factory_(this) { | 170 weak_factory_(this) { |
171 // Create a WebUIDataSource containing the chrome://media-router page's | 171 // Create a WebUIDataSource containing the chrome://media-router page's |
172 // content. | 172 // content. |
173 scoped_ptr<content::WebUIDataSource> html_source( | 173 std::unique_ptr<content::WebUIDataSource> html_source( |
174 content::WebUIDataSource::Create(chrome::kChromeUIMediaRouterHost)); | 174 content::WebUIDataSource::Create(chrome::kChromeUIMediaRouterHost)); |
175 | 175 |
176 content::WebContents* wc = web_ui->GetWebContents(); | 176 content::WebContents* wc = web_ui->GetWebContents(); |
177 DCHECK(wc); | 177 DCHECK(wc); |
178 | 178 |
179 router_ = | 179 router_ = |
180 MediaRouterFactory::GetApiForBrowserContext(wc->GetBrowserContext()); | 180 MediaRouterFactory::GetApiForBrowserContext(wc->GetBrowserContext()); |
181 | 181 |
182 // Allows UI to load extensionview. | 182 // Allows UI to load extensionview. |
183 // TODO(haibinlu): limit object-src to current extension once crbug/514866 | 183 // TODO(haibinlu): limit object-src to current extension once crbug/514866 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } else { | 225 } else { |
226 // Register for MediaRoute updates without a media source. | 226 // Register for MediaRoute updates without a media source. |
227 routes_observer_.reset(new UIMediaRoutesObserver(router_, MediaSource::Id(), | 227 routes_observer_.reset(new UIMediaRoutesObserver(router_, MediaSource::Id(), |
228 base::Bind(&MediaRouterUI::OnRoutesUpdated, base::Unretained(this)))); | 228 base::Bind(&MediaRouterUI::OnRoutesUpdated, base::Unretained(this)))); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 void MediaRouterUI::InitWithPresentationSessionRequest( | 232 void MediaRouterUI::InitWithPresentationSessionRequest( |
233 content::WebContents* initiator, | 233 content::WebContents* initiator, |
234 const base::WeakPtr<PresentationServiceDelegateImpl>& delegate, | 234 const base::WeakPtr<PresentationServiceDelegateImpl>& delegate, |
235 scoped_ptr<CreatePresentationConnectionRequest> create_session_request) { | 235 std::unique_ptr<CreatePresentationConnectionRequest> |
| 236 create_session_request) { |
236 DCHECK(initiator); | 237 DCHECK(initiator); |
237 DCHECK(create_session_request); | 238 DCHECK(create_session_request); |
238 DCHECK(!create_session_request_); | 239 DCHECK(!create_session_request_); |
239 DCHECK(!query_result_manager_); | 240 DCHECK(!query_result_manager_); |
240 | 241 |
241 create_session_request_ = std::move(create_session_request); | 242 create_session_request_ = std::move(create_session_request); |
242 presentation_service_delegate_ = delegate; | 243 presentation_service_delegate_ = delegate; |
243 InitCommon(initiator); | 244 InitCommon(initiator); |
244 OnDefaultPresentationChanged(create_session_request_->presentation_request()); | 245 OnDefaultPresentationChanged(create_session_request_->presentation_request()); |
245 } | 246 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 base::Time::Now() - start_time_); | 582 base::Time::Now() - start_time_); |
582 start_time_ = base::Time(); | 583 start_time_ = base::Time(); |
583 } | 584 } |
584 } | 585 } |
585 | 586 |
586 void MediaRouterUI::UpdateMaxDialogHeight(int height) { | 587 void MediaRouterUI::UpdateMaxDialogHeight(int height) { |
587 handler_->UpdateMaxDialogHeight(height); | 588 handler_->UpdateMaxDialogHeight(height); |
588 } | 589 } |
589 | 590 |
590 } // namespace media_router | 591 } // namespace media_router |
OLD | NEW |