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/chrome_security_state_model_client.h" | 10 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 bool BluetoothChooserAndroid::CanAskForScanningPermission() { | 56 bool BluetoothChooserAndroid::CanAskForScanningPermission() { |
57 // Creating the dialog returns null if Chromium can't ask for permission to | 57 // Creating the dialog returns null if Chromium can't ask for permission to |
58 // scan for BT devices. | 58 // scan for BT devices. |
59 return !java_dialog_.is_null(); | 59 return !java_dialog_.is_null(); |
60 } | 60 } |
61 | 61 |
62 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) { | 62 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) { |
63 if (presence != AdapterPresence::POWERED_ON) { | 63 if (presence != AdapterPresence::POWERED_ON) { |
64 Java_BluetoothChooserDialog_notifyAdapterTurnedOff(AttachCurrentThread(), | 64 Java_BluetoothChooserDialog_notifyAdapterTurnedOff(AttachCurrentThread(), |
65 java_dialog_.obj()); | 65 java_dialog_.obj()); |
| 66 } else { |
| 67 Java_BluetoothChooserDialog_notifyAdapterTurnedOn(AttachCurrentThread(), |
| 68 java_dialog_.obj()); |
66 } | 69 } |
67 } | 70 } |
68 | 71 |
69 void BluetoothChooserAndroid::ShowDiscoveryState(DiscoveryState state) { | 72 void BluetoothChooserAndroid::ShowDiscoveryState(DiscoveryState state) { |
70 // These constants are used in BluetoothChooserDialog.notifyDiscoveryState. | 73 // These constants are used in BluetoothChooserDialog.notifyDiscoveryState. |
71 int java_state = -1; | 74 int java_state = -1; |
72 switch (state) { | 75 switch (state) { |
73 case DiscoveryState::FAILED_TO_START: | 76 case DiscoveryState::FAILED_TO_START: |
74 java_state = 0; | 77 java_state = 0; |
75 break; | 78 break; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void BluetoothChooserAndroid::ShowNeedLocationPermissionLink( | 154 void BluetoothChooserAndroid::ShowNeedLocationPermissionLink( |
152 JNIEnv* env, | 155 JNIEnv* env, |
153 const JavaParamRef<jobject>& obj) { | 156 const JavaParamRef<jobject>& obj) { |
154 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, ""); | 157 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, ""); |
155 } | 158 } |
156 | 159 |
157 // static | 160 // static |
158 bool BluetoothChooserAndroid::Register(JNIEnv* env) { | 161 bool BluetoothChooserAndroid::Register(JNIEnv* env) { |
159 return RegisterNativesImpl(env); | 162 return RegisterNativesImpl(env); |
160 } | 163 } |
OLD | NEW |