| 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 "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/browser/web_contents_delegate.h" | 10 #include "content/public/browser/web_contents_delegate.h" |
| 11 #include "jni/ChromeMediaRouterDialogController_jni.h" |
| 10 | 12 |
| 11 DEFINE_WEB_CONTENTS_USER_DATA_KEY( | 13 DEFINE_WEB_CONTENTS_USER_DATA_KEY( |
| 12 media_router::MediaRouterDialogControllerAndroid); | 14 media_router::MediaRouterDialogControllerAndroid); |
| 13 | 15 |
| 14 using content::WebContents; | 16 using content::WebContents; |
| 15 | 17 |
| 16 namespace media_router { | 18 namespace media_router { |
| 17 | 19 |
| 18 // static | 20 // static |
| 19 MediaRouterDialogControllerAndroid* | 21 MediaRouterDialogControllerAndroid* |
| 20 MediaRouterDialogControllerAndroid::GetOrCreateForWebContents( | 22 MediaRouterDialogControllerAndroid::GetOrCreateForWebContents( |
| 21 WebContents* web_contents) { | 23 WebContents* web_contents) { |
| 22 DCHECK(web_contents); | 24 DCHECK(web_contents); |
| 23 // This call does nothing if the controller already exists. | 25 // This call does nothing if the controller already exists. |
| 24 MediaRouterDialogControllerAndroid::CreateForWebContents(web_contents); | 26 MediaRouterDialogControllerAndroid::CreateForWebContents(web_contents); |
| 25 return MediaRouterDialogControllerAndroid::FromWebContents(web_contents); | 27 return MediaRouterDialogControllerAndroid::FromWebContents(web_contents); |
| 26 } | 28 } |
| 27 | 29 |
| 28 MediaRouterDialogControllerAndroid::MediaRouterDialogControllerAndroid( | 30 MediaRouterDialogControllerAndroid::MediaRouterDialogControllerAndroid( |
| 29 WebContents* web_contents) | 31 WebContents* web_contents) |
| 30 : MediaRouterDialogController(web_contents) { | 32 : MediaRouterDialogController(web_contents) { |
| 33 JNIEnv* env = base::android::AttachCurrentThread(); |
| 34 java_dialog_controller_.Reset(Java_ChromeMediaRouterDialogController_create( |
| 35 env, |
| 36 reinterpret_cast<jlong>(this), |
| 37 base::android::GetApplicationContext())); |
| 38 } |
| 39 |
| 40 // static |
| 41 bool MediaRouterDialogControllerAndroid::Register(JNIEnv* env) { |
| 42 bool ret = RegisterNativesImpl(env); |
| 43 // No native calls to register yet. |
| 44 // DCHECK(g_ChromeMediaRouterDialogController_clazz); |
| 45 return ret; |
| 31 } | 46 } |
| 32 | 47 |
| 33 MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() { | 48 MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() { |
| 34 } | 49 } |
| 35 | 50 |
| 36 void MediaRouterDialogControllerAndroid::CreateMediaRouterDialog() { | 51 void MediaRouterDialogControllerAndroid::CreateMediaRouterDialog() { |
| 37 NOTIMPLEMENTED(); | 52 NOTIMPLEMENTED(); |
| 38 } | 53 } |
| 39 | 54 |
| 40 void MediaRouterDialogControllerAndroid::CloseMediaRouterDialog() { | 55 void MediaRouterDialogControllerAndroid::CloseMediaRouterDialog() { |
| 41 NOTIMPLEMENTED(); | 56 NOTIMPLEMENTED(); |
| 42 } | 57 } |
| 43 | 58 |
| 44 bool MediaRouterDialogControllerAndroid::IsShowingMediaRouterDialog() const { | 59 bool MediaRouterDialogControllerAndroid::IsShowingMediaRouterDialog() const { |
| 45 NOTIMPLEMENTED(); | 60 NOTIMPLEMENTED(); |
| 46 return false; | 61 return false; |
| 47 } | 62 } |
| 48 | 63 |
| 49 } // namespace media_router | 64 } // namespace media_router |
| 50 | 65 |
| OLD | NEW |