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

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

Issue 1842223003: Remove outdated devices from Android device chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on master. Created 4 years, 6 months 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/chrome_security_state_model_client.h" 10 #include "chrome/browser/ssl/chrome_security_state_model_client.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const base::string16& device_name) { 96 const base::string16& device_name) {
97 JNIEnv* env = AttachCurrentThread(); 97 JNIEnv* env = AttachCurrentThread();
98 ScopedJavaLocalRef<jstring> java_device_id = 98 ScopedJavaLocalRef<jstring> java_device_id =
99 ConvertUTF8ToJavaString(env, device_id); 99 ConvertUTF8ToJavaString(env, device_id);
100 ScopedJavaLocalRef<jstring> java_device_name = 100 ScopedJavaLocalRef<jstring> java_device_name =
101 ConvertUTF16ToJavaString(env, device_name); 101 ConvertUTF16ToJavaString(env, device_name);
102 Java_BluetoothChooserDialog_addDevice( 102 Java_BluetoothChooserDialog_addDevice(
103 env, java_dialog_.obj(), java_device_id.obj(), java_device_name.obj()); 103 env, java_dialog_.obj(), java_device_id.obj(), java_device_name.obj());
104 } 104 }
105 105
106 void BluetoothChooserAndroid::RemoveDevice(const std::string& device_id) {
ortuno 2016/06/14 15:29:33 I would separate this chooser clean up from the re
perja 2016/06/15 13:03:40 Acknowledged.
ortuno 2016/06/15 17:20:16 We usually say: "Done" :)
107 JNIEnv* env = AttachCurrentThread();
108 ScopedJavaLocalRef<jstring> java_device_id =
109 ConvertUTF16ToJavaString(env, base::UTF8ToUTF16(device_id));
110 Java_BluetoothChooserDialog_removeDevice(env, java_dialog_.obj(),
111 java_device_id.obj());
112 }
113
114 void BluetoothChooserAndroid::OnDialogFinished( 106 void BluetoothChooserAndroid::OnDialogFinished(
115 JNIEnv* env, 107 JNIEnv* env,
116 const JavaParamRef<jobject>& obj, 108 const JavaParamRef<jobject>& obj,
117 jint event_type, 109 jint event_type,
118 const JavaParamRef<jstring>& device_id) { 110 const JavaParamRef<jstring>& device_id) {
119 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants. 111 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants.
120 switch (event_type) { 112 switch (event_type) {
121 case 0: 113 case 0:
122 event_handler_.Run(Event::DENIED_PERMISSION, ""); 114 event_handler_.Run(Event::DENIED_PERMISSION, "");
123 return; 115 return;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // static 158 // static
167 bool BluetoothChooserAndroid::Register(JNIEnv* env) { 159 bool BluetoothChooserAndroid::Register(JNIEnv* env) {
168 return RegisterNativesImpl(env); 160 return RegisterNativesImpl(env);
169 } 161 }
170 162
171 void BluetoothChooserAndroid::OpenURL(const char* url) { 163 void BluetoothChooserAndroid::OpenURL(const char* url) {
172 web_contents_->OpenURL(content::OpenURLParams( 164 web_contents_->OpenURL(content::OpenURLParams(
173 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, 165 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB,
174 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); 166 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */));
175 } 167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698