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

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: Fixed unit test for ItemChooserDialog Created 4 years, 8 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/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const base::string16& device_name) { 103 const base::string16& device_name) {
104 JNIEnv* env = AttachCurrentThread(); 104 JNIEnv* env = AttachCurrentThread();
105 ScopedJavaLocalRef<jstring> java_device_id = 105 ScopedJavaLocalRef<jstring> java_device_id =
106 ConvertUTF8ToJavaString(env, device_id); 106 ConvertUTF8ToJavaString(env, device_id);
107 ScopedJavaLocalRef<jstring> java_device_name = 107 ScopedJavaLocalRef<jstring> java_device_name =
108 ConvertUTF16ToJavaString(env, device_name); 108 ConvertUTF16ToJavaString(env, device_name);
109 Java_BluetoothChooserDialog_addDevice( 109 Java_BluetoothChooserDialog_addDevice(
110 env, java_dialog_.obj(), java_device_id.obj(), java_device_name.obj()); 110 env, java_dialog_.obj(), java_device_id.obj(), java_device_name.obj());
111 } 111 }
112 112
113 void BluetoothChooserAndroid::RemoveDevice(const std::string& device_id) {
114 JNIEnv* env = AttachCurrentThread();
115 ScopedJavaLocalRef<jstring> java_device_id =
116 ConvertUTF16ToJavaString(env, base::UTF8ToUTF16(device_id));
117 Java_BluetoothChooserDialog_removeDevice(env, java_dialog_.obj(),
118 java_device_id.obj());
119 }
120
121 void BluetoothChooserAndroid::OnDialogFinished( 113 void BluetoothChooserAndroid::OnDialogFinished(
122 JNIEnv* env, 114 JNIEnv* env,
123 const JavaParamRef<jobject>& obj, 115 const JavaParamRef<jobject>& obj,
124 jint event_type, 116 jint event_type,
125 const JavaParamRef<jstring>& device_id) { 117 const JavaParamRef<jstring>& device_id) {
126 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants. 118 // Values are defined in BluetoothChooserDialog as DIALOG_FINISHED constants.
127 switch (event_type) { 119 switch (event_type) {
128 case 0: 120 case 0:
129 event_handler_.Run(Event::DENIED_PERMISSION, ""); 121 event_handler_.Run(Event::DENIED_PERMISSION, "");
130 return; 122 return;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // static 165 // static
174 bool BluetoothChooserAndroid::Register(JNIEnv* env) { 166 bool BluetoothChooserAndroid::Register(JNIEnv* env) {
175 return RegisterNativesImpl(env); 167 return RegisterNativesImpl(env);
176 } 168 }
177 169
178 void BluetoothChooserAndroid::OpenURL(const char* url) { 170 void BluetoothChooserAndroid::OpenURL(const char* url) {
179 web_contents_->OpenURL(content::OpenURLParams( 171 web_contents_->OpenURL(content::OpenURLParams(
180 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, 172 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB,
181 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); 173 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */));
182 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698