Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/media/android/router/media_router_dialog_controller_android.cc

Issue 1270353003: [PresentationAPI, Android] Add ChromeMediaRouterDialogController.java and bind it with the native M… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media-router-jni
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHECK(env);
Bernhard Bauer 2015/08/06 15:23:01 Is this CHECK actually necessary? I would only exp
whywhat 2015/08/06 15:27:13 I'd think in such exceptional circumstances one sh
Bernhard Bauer 2015/08/06 15:40:33 I have never seen it, TBH. If anything, we should
whywhat 2015/08/06 16:29:20 Ok, CHECK removed.
35 java_dialog_controller_.Reset(Java_ChromeMediaRouterDialogController_create(
36 env,
37 reinterpret_cast<intptr_t>(this),
38 base::android::GetApplicationContext()));
39 }
40
41 // static
42 bool MediaRouterDialogControllerAndroid::Register(JNIEnv* env) {
43 bool ret = RegisterNativesImpl(env);
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698