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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java

Issue 1145313006: Refactor and improve UserRecoverableErrorHandler for Play Services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bauerb@'s suggestions Created 5 years, 7 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
index fbd05efd33e71ad69644fc4b4cf7e980d6af0ea3..51b7c70e07929f49aa3e65e18f0c3b59d7b77e0a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
@@ -156,11 +156,8 @@ public class ExternalAuthUtils {
/**
* Checks whether Google Play Services can be used, applying the specified error-handling
- * policy if a user-recoverable error occurs. To avoid undue burden on the user, the error
- * handling policy will be applied at most one time per browser startup (i.e., a dialog or
- * a system notification).
- * This method is threadsafe. If the specified error-handling policy requires UI interaction,
- * an asynchronous task will be posted to the main thread to perform such interaction.
+ * policy if a user-recoverable error occurs. This method is threadsafe. If the specified
+ * error-handling policy requires UI interaction, it will be run on the UI thread.
* @param context The current context.
* @param errorHandler How to handle user-recoverable errors; must be non-null.
* @return true if and only if Google Play Services can be used
@@ -171,11 +168,16 @@ public class ExternalAuthUtils {
if (errorCode == ConnectionResult.SUCCESS) {
return true; // Hooray!
}
- // The rest of the method is error-handling bits.
Log.v(TAG, "Unable to use Google Play Services: %s",
GooglePlayServicesUtil.getErrorString(errorCode));
if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) {
- ThreadUtils.runOnUiThread(errorHandler);
+ Runnable errorHandlerTask = new Runnable() {
+ @Override
+ public void run() {
+ errorHandler.handleError(context, errorCode);
+ }
+ };
+ ThreadUtils.runOnUiThread(errorHandlerTask);
}
return false;
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698