| 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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/media/android/router/media_router_android.h" | 9 #include "chrome/browser/media/android/router/media_router_android.h" |
| 10 #include "chrome/browser/media/router/media_router.h" | 10 #include "chrome/browser/media/router/media_router.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 CancelPresentationRequest(); | 81 CancelPresentationRequest(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void MediaRouterDialogControllerAndroid::OnDialogCancelled( | 84 void MediaRouterDialogControllerAndroid::OnDialogCancelled( |
| 85 JNIEnv* env, | 85 JNIEnv* env, |
| 86 const JavaParamRef<jobject>& obj) { | 86 const JavaParamRef<jobject>& obj) { |
| 87 CancelPresentationRequest(); | 87 CancelPresentationRequest(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void MediaRouterDialogControllerAndroid::OnMediaSourceNotSupported( |
| 91 JNIEnv* env, |
| 92 const JavaParamRef<jobject>& obj) { |
| 93 std::unique_ptr<CreatePresentationConnectionRequest> request = |
| 94 TakeCreateConnectionRequest(); |
| 95 if (!request) |
| 96 return; |
| 97 |
| 98 request->InvokeErrorCallback(content::PresentationError( |
| 99 content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS, "No screens found.")); |
| 100 } |
| 101 |
| 90 void MediaRouterDialogControllerAndroid::CancelPresentationRequest() { | 102 void MediaRouterDialogControllerAndroid::CancelPresentationRequest() { |
| 91 std::unique_ptr<CreatePresentationConnectionRequest> request = | 103 std::unique_ptr<CreatePresentationConnectionRequest> request = |
| 92 TakeCreateConnectionRequest(); | 104 TakeCreateConnectionRequest(); |
| 93 if (!request) | 105 if (!request) |
| 94 return; | 106 return; |
| 95 | 107 |
| 96 request->InvokeErrorCallback(content::PresentationError( | 108 request->InvokeErrorCallback(content::PresentationError( |
| 97 content::PRESENTATION_ERROR_PRESENTATION_REQUEST_CANCELLED, | 109 content::PRESENTATION_ERROR_PRESENTATION_REQUEST_CANCELLED, |
| 98 "Dialog closed.")); | 110 "Dialog closed.")); |
| 99 } | 111 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 168 } |
| 157 | 169 |
| 158 bool MediaRouterDialogControllerAndroid::IsShowingMediaRouterDialog() const { | 170 bool MediaRouterDialogControllerAndroid::IsShowingMediaRouterDialog() const { |
| 159 JNIEnv* env = base::android::AttachCurrentThread(); | 171 JNIEnv* env = base::android::AttachCurrentThread(); |
| 160 return Java_ChromeMediaRouterDialogController_isShowingDialog( | 172 return Java_ChromeMediaRouterDialogController_isShowingDialog( |
| 161 env, java_dialog_controller_); | 173 env, java_dialog_controller_); |
| 162 } | 174 } |
| 163 | 175 |
| 164 } // namespace media_router | 176 } // namespace media_router |
| 165 | 177 |
| OLD | NEW |