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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // scan for BT devices. | 63 // scan for BT devices. |
64 return !java_dialog_.is_null(); | 64 return !java_dialog_.is_null(); |
65 } | 65 } |
66 | 66 |
67 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) { | 67 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) { |
68 JNIEnv* env = AttachCurrentThread(); | 68 JNIEnv* env = AttachCurrentThread(); |
69 if (presence != AdapterPresence::POWERED_ON) { | 69 if (presence != AdapterPresence::POWERED_ON) { |
70 Java_BluetoothChooserDialog_notifyAdapterTurnedOff(env, java_dialog_.obj()); | 70 Java_BluetoothChooserDialog_notifyAdapterTurnedOff(env, java_dialog_.obj()); |
71 } else { | 71 } else { |
72 Java_BluetoothChooserDialog_notifyAdapterTurnedOn(env, java_dialog_.obj()); | 72 Java_BluetoothChooserDialog_notifyAdapterTurnedOn(env, java_dialog_.obj()); |
73 RestartSearch(); | |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 void BluetoothChooserAndroid::ShowDiscoveryState(DiscoveryState state) { | 76 void BluetoothChooserAndroid::ShowDiscoveryState(DiscoveryState state) { |
78 // These constants are used in BluetoothChooserDialog.notifyDiscoveryState. | 77 // These constants are used in BluetoothChooserDialog.notifyDiscoveryState. |
79 int java_state = -1; | 78 int java_state = -1; |
80 switch (state) { | 79 switch (state) { |
81 case DiscoveryState::FAILED_TO_START: | 80 case DiscoveryState::FAILED_TO_START: |
82 java_state = 0; | 81 java_state = 0; |
83 break; | 82 break; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // static | 165 // static |
167 bool BluetoothChooserAndroid::Register(JNIEnv* env) { | 166 bool BluetoothChooserAndroid::Register(JNIEnv* env) { |
168 return RegisterNativesImpl(env); | 167 return RegisterNativesImpl(env); |
169 } | 168 } |
170 | 169 |
171 void BluetoothChooserAndroid::OpenURL(const char* url) { | 170 void BluetoothChooserAndroid::OpenURL(const char* url) { |
172 web_contents_->OpenURL(content::OpenURLParams( | 171 web_contents_->OpenURL(content::OpenURLParams( |
173 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, | 172 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, |
174 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); | 173 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); |
175 } | 174 } |
OLD | NEW |