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/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_tab_helper.h" | 10 #include "chrome/browser/ssl/security_state_tab_helper.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 const base::string16& device_name, | 99 const base::string16& device_name, |
100 bool is_gatt_connected, | 100 bool is_gatt_connected, |
101 bool is_paired, | 101 bool is_paired, |
102 int signal_strength_level) { | 102 int signal_strength_level) { |
103 JNIEnv* env = AttachCurrentThread(); | 103 JNIEnv* env = AttachCurrentThread(); |
104 ScopedJavaLocalRef<jstring> java_device_id = | 104 ScopedJavaLocalRef<jstring> java_device_id = |
105 ConvertUTF8ToJavaString(env, device_id); | 105 ConvertUTF8ToJavaString(env, device_id); |
106 ScopedJavaLocalRef<jstring> java_device_name = | 106 ScopedJavaLocalRef<jstring> java_device_name = |
107 ConvertUTF16ToJavaString(env, device_name); | 107 ConvertUTF16ToJavaString(env, device_name); |
108 Java_BluetoothChooserDialog_addOrUpdateDevice( | 108 Java_BluetoothChooserDialog_addOrUpdateDevice( |
109 env, java_dialog_, java_device_id, java_device_name); | 109 env, java_dialog_, java_device_id, java_device_name, is_gatt_connected); |
110 } | 110 } |
111 | 111 |
112 void BluetoothChooserAndroid::OnDialogFinished( | 112 void BluetoothChooserAndroid::OnDialogFinished( |
113 JNIEnv* env, | 113 JNIEnv* env, |
114 const JavaParamRef<jobject>& obj, | 114 const JavaParamRef<jobject>& obj, |
115 jint event_type, | 115 jint event_type, |
116 const JavaParamRef<jstring>& device_id) { | 116 const JavaParamRef<jstring>& device_id) { |
117 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants. | 117 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants. |
118 switch (event_type) { | 118 switch (event_type) { |
119 case 0: | 119 case 0: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // static | 164 // static |
165 bool BluetoothChooserAndroid::Register(JNIEnv* env) { | 165 bool BluetoothChooserAndroid::Register(JNIEnv* env) { |
166 return RegisterNativesImpl(env); | 166 return RegisterNativesImpl(env); |
167 } | 167 } |
168 | 168 |
169 void BluetoothChooserAndroid::OpenURL(const char* url) { | 169 void BluetoothChooserAndroid::OpenURL(const char* url) { |
170 web_contents_->OpenURL(content::OpenURLParams( | 170 web_contents_->OpenURL(content::OpenURLParams( |
171 GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, | 171 GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
172 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); | 172 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); |
173 } | 173 } |
OLD | NEW |