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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/HostListLoader.java

Issue 348433002: Verify the host-supplied URL matches the domain's allowed URL patterns (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 package org.chromium.chromoting; 5 package org.chromium.chromoting;
6 6
7 import android.os.Handler; 7 import android.os.Handler;
8 import android.os.HandlerThread; 8 import android.os.HandlerThread;
9 import android.os.Looper; 9 import android.os.Looper;
10 import android.util.Log; 10 import android.util.Log;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 Log.i("hostlist", "Received host listing from directory server") ; 138 Log.i("hostlist", "Received host listing from directory server") ;
139 139
140 int index = 0; 140 int index = 0;
141 while (!hostsJson.isNull(index)) { 141 while (!hostsJson.isNull(index)) {
142 JSONObject hostJson = hostsJson.getJSONObject(index); 142 JSONObject hostJson = hostsJson.getJSONObject(index);
143 // If a host is only recently registered, it may be missing some of the keys 143 // If a host is only recently registered, it may be missing some of the keys
144 // below. It should still be visible in the list, even thoug h a connection 144 // below. It should still be visible in the list, even thoug h a connection
145 // attempt will fail because of the missing keys. The failed attempt will 145 // attempt will fail because of the missing keys. The failed attempt will
146 // trigger reloading of the host-list, by which time the key s will hopefully be 146 // trigger reloading of the host-list, by which time the key s will hopefully be
147 // present, and the retried connection can succeed. 147 // present, and the retried connection can succeed.
148 HostInfo host = new HostInfo( 148 HostInfo host = HostInfo.create(hostJson);
149 hostJson.getString("hostName"),
150 hostJson.getString("hostId"),
151 hostJson.optString("jabberId"),
152 hostJson.optString("publicKey"),
153 hostJson.optString("status").equals("ONLINE"));
154 hostList.add(host); 149 hostList.add(host);
155 ++index; 150 ++index;
156 } 151 }
157 } 152 }
158 } catch (JSONException ex) { 153 } catch (JSONException ex) {
159 Log.e("hostlist", "Error parsing host list response: ", ex); 154 Log.e("hostlist", "Error parsing host list response: ", ex);
160 postError(callback, Error.UNEXPECTED_RESPONSE); 155 postError(callback, Error.UNEXPECTED_RESPONSE);
161 return; 156 return;
162 } 157 }
163 158
(...skipping 29 matching lines...) Expand all
193 return a.isOnline ? -1 : 1; 188 return a.isOnline ? -1 : 1;
194 } 189 }
195 String aName = a.name.toUpperCase(Locale.getDefault()); 190 String aName = a.name.toUpperCase(Locale.getDefault());
196 String bName = b.name.toUpperCase(Locale.getDefault()); 191 String bName = b.name.toUpperCase(Locale.getDefault());
197 return aName.compareTo(bName); 192 return aName.compareTo(bName);
198 } 193 }
199 }; 194 };
200 Collections.sort(hosts, hostComparator); 195 Collections.sort(hosts, hostComparator);
201 } 196 }
202 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698