| 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/context_utils.h" | |
| 8 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 10 #include "chrome/browser/media/android/router/media_router_android.h" | 9 #include "chrome/browser/media/android/router/media_router_android.h" |
| 11 #include "chrome/browser/media/router/media_router.h" | 10 #include "chrome/browser/media/router/media_router.h" |
| 12 #include "chrome/browser/media/router/media_router_factory.h" | 11 #include "chrome/browser/media/router/media_router_factory.h" |
| 13 #include "chrome/browser/media/router/media_source.h" | 12 #include "chrome/browser/media/router/media_source.h" |
| 14 #include "chrome/browser/media/router/presentation_request.h" | 13 #include "chrome/browser/media/router/presentation_request.h" |
| 15 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
| 16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 request->InvokeErrorCallback(content::PresentationError( | 96 request->InvokeErrorCallback(content::PresentationError( |
| 98 content::PRESENTATION_ERROR_PRESENTATION_REQUEST_CANCELLED, | 97 content::PRESENTATION_ERROR_PRESENTATION_REQUEST_CANCELLED, |
| 99 "Dialog closed.")); | 98 "Dialog closed.")); |
| 100 } | 99 } |
| 101 | 100 |
| 102 MediaRouterDialogControllerAndroid::MediaRouterDialogControllerAndroid( | 101 MediaRouterDialogControllerAndroid::MediaRouterDialogControllerAndroid( |
| 103 WebContents* web_contents) | 102 WebContents* web_contents) |
| 104 : MediaRouterDialogController(web_contents) { | 103 : MediaRouterDialogController(web_contents) { |
| 105 JNIEnv* env = base::android::AttachCurrentThread(); | 104 JNIEnv* env = base::android::AttachCurrentThread(); |
| 106 java_dialog_controller_.Reset(Java_ChromeMediaRouterDialogController_create( | 105 java_dialog_controller_.Reset(Java_ChromeMediaRouterDialogController_create( |
| 107 env, | 106 env, reinterpret_cast<jlong>(this))); |
| 108 reinterpret_cast<jlong>(this), | |
| 109 base::android::GetApplicationContext())); | |
| 110 } | 107 } |
| 111 | 108 |
| 112 // static | 109 // static |
| 113 bool MediaRouterDialogControllerAndroid::Register(JNIEnv* env) { | 110 bool MediaRouterDialogControllerAndroid::Register(JNIEnv* env) { |
| 114 return RegisterNativesImpl(env); | 111 return RegisterNativesImpl(env); |
| 115 } | 112 } |
| 116 | 113 |
| 117 MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() { | 114 MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() { |
| 118 } | 115 } |
| 119 | 116 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 156 } |
| 160 | 157 |
| 161 bool MediaRouterDialogControllerAndroid::IsShowingMediaRouterDialog() const { | 158 bool MediaRouterDialogControllerAndroid::IsShowingMediaRouterDialog() const { |
| 162 JNIEnv* env = base::android::AttachCurrentThread(); | 159 JNIEnv* env = base::android::AttachCurrentThread(); |
| 163 return Java_ChromeMediaRouterDialogController_isShowingDialog( | 160 return Java_ChromeMediaRouterDialogController_isShowingDialog( |
| 164 env, java_dialog_controller_); | 161 env, java_dialog_controller_); |
| 165 } | 162 } |
| 166 | 163 |
| 167 } // namespace media_router | 164 } // namespace media_router |
| 168 | 165 |
| OLD | NEW |