зеркало из https://github.com/mozilla/gecko-dev.git
Bug 842395 - Remove areClientsAvailable() from TabsAccessor. r=mfinkle
--HG-- extra : rebase_source : edca3b7010a8a4cae538ca9632d98e3201a135c1
This commit is contained in:
Родитель
05d5e1ef99
Коммит
63866d92a5
|
@ -60,46 +60,6 @@ public final class TabsAccessor {
|
||||||
public void onQueryTabsComplete(List<RemoteTab> tabs);
|
public void onQueryTabsComplete(List<RemoteTab> tabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnClientsAvailableListener {
|
|
||||||
public void areAvailable(boolean available);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper method to check if there are any clients available
|
|
||||||
public static void areClientsAvailable(final Context context, final OnClientsAvailableListener listener) {
|
|
||||||
if (listener == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
(new GeckoAsyncTask<Void, Void, Boolean>(GeckoApp.mAppContext, GeckoAppShell.getHandler()) {
|
|
||||||
@Override
|
|
||||||
protected Boolean doInBackground(Void... unused) {
|
|
||||||
Uri uri = BrowserContract.Tabs.CONTENT_URI;
|
|
||||||
uri = uri.buildUpon()
|
|
||||||
.appendQueryParameter(BrowserContract.PARAM_LIMIT, "1")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Cursor cursor = context.getContentResolver().query(uri,
|
|
||||||
CLIENTS_AVAILABILITY_PROJECTION,
|
|
||||||
CLIENTS_SELECTION,
|
|
||||||
null,
|
|
||||||
null);
|
|
||||||
|
|
||||||
if (cursor == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
try {
|
|
||||||
return cursor.moveToNext();
|
|
||||||
} finally {
|
|
||||||
cursor.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Boolean availability) {
|
|
||||||
listener.areAvailable(availability);
|
|
||||||
}
|
|
||||||
}).setPriority(GeckoAsyncTask.Priority.HIGH).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method returns all tabs from all remote clients,
|
// This method returns all tabs from all remote clients,
|
||||||
// ordered by most recent client first, most recent tab first
|
// ordered by most recent client first, most recent tab first
|
||||||
public static void getTabs(final Context context, final OnQueryTabsCompleteListener listener) {
|
public static void getTabs(final Context context, final OnQueryTabsCompleteListener listener) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче