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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 bool BluetoothChooserAndroid::CanAskForScanningPermission() { | 58 bool BluetoothChooserAndroid::CanAskForScanningPermission() { |
59 // Creating the dialog returns null if Chromium can't ask for permission to | 59 // Creating the dialog returns null if Chromium can't ask for permission to |
60 // scan for BT devices. | 60 // scan for BT devices. |
61 return !java_dialog_.is_null(); | 61 return !java_dialog_.is_null(); |
62 } | 62 } |
63 | 63 |
64 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) { | 64 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) { |
65 if (presence != AdapterPresence::POWERED_ON) { | 65 if (presence != AdapterPresence::POWERED_ON) { |
66 Java_BluetoothChooserDialog_notifyAdapterTurnedOff(AttachCurrentThread(), | 66 Java_BluetoothChooserDialog_notifyAdapterTurnedOff(AttachCurrentThread(), |
67 java_dialog_.obj()); | 67 java_dialog_.obj()); |
| 68 } else { |
| 69 Java_BluetoothChooserDialog_notifyAdapterTurnedOn(AttachCurrentThread(), |
| 70 java_dialog_.obj()); |
68 } | 71 } |
69 } | 72 } |
70 | 73 |
71 void BluetoothChooserAndroid::ShowDiscoveryState(DiscoveryState state) { | 74 void BluetoothChooserAndroid::ShowDiscoveryState(DiscoveryState state) { |
72 // These constants are used in BluetoothChooserDialog.notifyDiscoveryState. | 75 // These constants are used in BluetoothChooserDialog.notifyDiscoveryState. |
73 int java_state = -1; | 76 int java_state = -1; |
74 switch (state) { | 77 switch (state) { |
75 case DiscoveryState::FAILED_TO_START: | 78 case DiscoveryState::FAILED_TO_START: |
76 java_state = 0; | 79 java_state = 0; |
77 break; | 80 break; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // static | 159 // static |
157 bool BluetoothChooserAndroid::Register(JNIEnv* env) { | 160 bool BluetoothChooserAndroid::Register(JNIEnv* env) { |
158 return RegisterNativesImpl(env); | 161 return RegisterNativesImpl(env); |
159 } | 162 } |
160 | 163 |
161 void BluetoothChooserAndroid::OpenURL(const char* url) { | 164 void BluetoothChooserAndroid::OpenURL(const char* url) { |
162 web_contents_->OpenURL(content::OpenURLParams( | 165 web_contents_->OpenURL(content::OpenURLParams( |
163 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, | 166 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, |
164 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); | 167 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); |
165 } | 168 } |
OLD | NEW |