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

Side by Side Diff: chrome/browser/ui/android/bluetooth_chooser_android.cc

Issue 1481553002: jni: Pass method parameters as JavaParamRef in chrome/browser/ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/ui/android/bluetooth_chooser_android.h" 5 #include "chrome/browser/ui/android/bluetooth_chooser_android.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 "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ssl/security_state_model.h" 10 #include "chrome/browser/ssl/security_state_model.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 void BluetoothChooserAndroid::RemoveDevice(const std::string& device_id) { 93 void BluetoothChooserAndroid::RemoveDevice(const std::string& device_id) {
94 JNIEnv* env = AttachCurrentThread(); 94 JNIEnv* env = AttachCurrentThread();
95 ScopedJavaLocalRef<jstring> java_device_id = 95 ScopedJavaLocalRef<jstring> java_device_id =
96 ConvertUTF16ToJavaString(env, base::UTF8ToUTF16(device_id)); 96 ConvertUTF16ToJavaString(env, base::UTF8ToUTF16(device_id));
97 Java_BluetoothChooserDialog_removeDevice(env, java_dialog_.obj(), 97 Java_BluetoothChooserDialog_removeDevice(env, java_dialog_.obj(),
98 java_device_id.obj()); 98 java_device_id.obj());
99 } 99 }
100 100
101 void BluetoothChooserAndroid::OnDialogFinished(JNIEnv* env, 101 void BluetoothChooserAndroid::OnDialogFinished(
102 jobject obj, 102 JNIEnv* env,
103 jint event_type, 103 const JavaParamRef<jobject>& obj,
104 jstring device_id) { 104 jint event_type,
105 const JavaParamRef<jstring>& device_id) {
105 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants. 106 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants.
106 switch (event_type) { 107 switch (event_type) {
107 case 0: 108 case 0:
108 event_handler_.Run(Event::DENIED_PERMISSION, ""); 109 event_handler_.Run(Event::DENIED_PERMISSION, "");
109 return; 110 return;
110 case 1: 111 case 1:
111 event_handler_.Run(Event::CANCELLED, ""); 112 event_handler_.Run(Event::CANCELLED, "");
112 return; 113 return;
113 case 2: 114 case 2:
114 event_handler_.Run( 115 event_handler_.Run(
115 Event::SELECTED, 116 Event::SELECTED,
116 base::android::ConvertJavaStringToUTF8(env, device_id)); 117 base::android::ConvertJavaStringToUTF8(env, device_id));
117 return; 118 return;
118 } 119 }
119 NOTREACHED(); 120 NOTREACHED();
120 } 121 }
121 122
122 void BluetoothChooserAndroid::RestartSearch(JNIEnv* env, jobject obj) { 123 void BluetoothChooserAndroid::RestartSearch(JNIEnv* env,
124 const JavaParamRef<jobject>& obj) {
123 event_handler_.Run(Event::RESCAN, ""); 125 event_handler_.Run(Event::RESCAN, "");
124 } 126 }
125 127
126 void BluetoothChooserAndroid::ShowBluetoothOverviewLink(JNIEnv* env, 128 void BluetoothChooserAndroid::ShowBluetoothOverviewLink(
127 jobject obj) { 129 JNIEnv* env,
130 const JavaParamRef<jobject>& obj) {
128 event_handler_.Run(Event::SHOW_OVERVIEW_HELP, ""); 131 event_handler_.Run(Event::SHOW_OVERVIEW_HELP, "");
129 } 132 }
130 133
131 void BluetoothChooserAndroid::ShowBluetoothPairingLink(JNIEnv* env, 134 void BluetoothChooserAndroid::ShowBluetoothPairingLink(
132 jobject obj) { 135 JNIEnv* env,
136 const JavaParamRef<jobject>& obj) {
133 event_handler_.Run(Event::SHOW_PAIRING_HELP, ""); 137 event_handler_.Run(Event::SHOW_PAIRING_HELP, "");
134 } 138 }
135 139
136 void BluetoothChooserAndroid::ShowBluetoothAdapterOffLink(JNIEnv* env, 140 void BluetoothChooserAndroid::ShowBluetoothAdapterOffLink(
137 jobject obj) { 141 JNIEnv* env,
142 const JavaParamRef<jobject>& obj) {
138 event_handler_.Run(Event::SHOW_ADAPTER_OFF_HELP, ""); 143 event_handler_.Run(Event::SHOW_ADAPTER_OFF_HELP, "");
139 } 144 }
140 145
141 void BluetoothChooserAndroid::ShowNeedLocationPermissionLink(JNIEnv* env, 146 void BluetoothChooserAndroid::ShowNeedLocationPermissionLink(
142 jobject obj) { 147 JNIEnv* env,
148 const JavaParamRef<jobject>& obj) {
143 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, ""); 149 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, "");
144 } 150 }
145 151
146 // static 152 // static
147 bool BluetoothChooserAndroid::Register(JNIEnv* env) { 153 bool BluetoothChooserAndroid::Register(JNIEnv* env) {
148 return RegisterNativesImpl(env); 154 return RegisterNativesImpl(env);
149 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.h ('k') | chrome/browser/ui/android/chrome_http_auth_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698