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

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/gcore/GoogleApiClientConnectionHelper.java

Issue 1206673003: Merge java_staging/src into java/src. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java_staging/src/org/chromium/chrome/browser/gcore/GoogleApiClientConnectionHelper.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/gcore/GoogleApiClientConnectionHelper.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/gcore/GoogleApiClientConnectionHelper.java
deleted file mode 100644
index 03371ccfbf9682e4973f443012488c84b4472ea2..0000000000000000000000000000000000000000
--- a/chrome/android/java_staging/src/org/chromium/chrome/browser/gcore/GoogleApiClientConnectionHelper.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.gcore;
-
-import android.os.Bundle;
-import android.os.Handler;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
-import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
-
-/**
- * Helper that allows to manage connection failures when using {@link GoogleApiClient}.
- *
- * When the connection fails, it will try to reconnect {@link ConnectedTask#RETRY_NUMBER_LIMIT}
- * times in the background, waiting {@link ConnectedTask#CONNECTION_RETRY_TIME_MS} milliseconds
- * between each attempt.
- */
-public class GoogleApiClientConnectionHelper
- implements OnConnectionFailedListener, ConnectionCallbacks {
- private int mResolutionAttempts = 0;
- private Handler mHandler;
- private final GoogleApiClient mClient;
-
- public GoogleApiClientConnectionHelper(GoogleApiClient client) {
- mClient = client;
- mClient.registerConnectionCallbacks(this);
- mClient.registerConnectionFailedListener(this);
- }
-
- @Override
- public void onConnectionFailed(ConnectionResult result) {
- if (mResolutionAttempts++ < ConnectedTask.RETRY_NUMBER_LIMIT) {
- if (mHandler == null) mHandler = new Handler();
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- mClient.connect();
- }
- }, ConnectedTask.CONNECTION_RETRY_TIME_MS);
- }
- }
-
- @Override
- public void onConnected(Bundle connectionHint) {
- mResolutionAttempts = 0;
- }
-
- @Override
- public void onConnectionSuspended(int cause) {}
-}

Powered by Google App Engine
This is Rietveld 408576698