| 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/media/android/router/media_router_dialog_controller_and
roid.h" | 5 #include "chrome/browser/media/android/router/media_router_dialog_controller_and
roid.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
| 10 | 10 |
| 11 DEFINE_WEB_CONTENTS_USER_DATA_KEY( | 11 DEFINE_WEB_CONTENTS_USER_DATA_KEY( |
| 12 media_router::MediaRouterDialogControllerAndroid); | 12 media_router::MediaRouterDialogControllerAndroid); |
| 13 | 13 |
| 14 using content::WebContents; | 14 using content::WebContents; |
| 15 | 15 |
| 16 namespace media_router { | 16 namespace media_router { |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 MediaRouterDialogControllerAndroid* | 19 MediaRouterDialogControllerAndroid* |
| 20 MediaRouterDialogControllerAndroid::GetOrCreateForWebContents( | 20 MediaRouterDialogControllerAndroid::GetOrCreateForWebContents( |
| 21 WebContents* web_contents) { | 21 WebContents* web_contents) { |
| 22 DCHECK(web_contents); | 22 DCHECK(web_contents); |
| 23 // This call does nothing if the controller already exists. | 23 // This call does nothing if the controller already exists. |
| 24 MediaRouterDialogControllerAndroid::CreateForWebContents(web_contents); | 24 MediaRouterDialogControllerAndroid::CreateForWebContents(web_contents); |
| 25 return MediaRouterDialogControllerAndroid::FromWebContents(web_contents); | 25 return MediaRouterDialogControllerAndroid::FromWebContents(web_contents); |
| 26 } | 26 } |
| 27 | 27 |
| 28 MediaRouterDialogControllerAndroid::MediaRouterDialogControllerAndroid( | 28 MediaRouterDialogControllerAndroid::MediaRouterDialogControllerAndroid( |
| 29 WebContents* web_contents) { | 29 WebContents* web_contents) |
| 30 : MediaRouterDialogController(web_contents) { |
| 30 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 31 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 31 } | 32 } |
| 32 | 33 |
| 33 MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() { | 34 MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() { |
| 34 DCHECK(thread_checker_.CalledOnValidThread()); | 35 DCHECK(thread_checker_.CalledOnValidThread()); |
| 35 } | 36 } |
| 36 | 37 |
| 37 bool MediaRouterDialogControllerAndroid::ShowMediaRouterDialogForPresentation( | 38 bool MediaRouterDialogControllerAndroid::ShowMediaRouterDialogForPresentation( |
| 38 scoped_ptr<CreatePresentationSessionRequest> request) { | 39 scoped_ptr<CreatePresentationSessionRequest> request) { |
| 39 DCHECK(thread_checker_.CalledOnValidThread()); | 40 DCHECK(thread_checker_.CalledOnValidThread()); |
| 41 SetPresentationRequest(request.Pass()); |
| 42 ActivateInitiatorWebContents(); |
| 43 MediaRouterDialogController::CreateMediaRouterDialog(); |
| 40 return false; | 44 return false; |
| 41 } | 45 } |
| 42 | 46 |
| 47 void MediaRouterDialogControllerAndroid::CloseMediaRouterDialog() { |
| 48 MediaRouterDialogController::CloseMediaRouterDialog(); |
| 49 } |
| 50 |
| 51 void MediaRouterDialogControllerAndroid::Reset() { |
| 52 } |
| 53 |
| 43 } // namespace media_router | 54 } // namespace media_router |
| 44 | 55 |
| OLD | NEW |