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

Unified Diff: chrome/android/testshell/java/src/org/chromium/chrome/testshell/signin/AccountsChangedReceiver.java

Issue 184493006: Rename to ChromiumTestShell package from testshell to shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix py lint Created 6 years, 10 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/testshell/java/src/org/chromium/chrome/testshell/signin/AccountsChangedReceiver.java
diff --git a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/signin/AccountsChangedReceiver.java b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/signin/AccountsChangedReceiver.java
deleted file mode 100644
index 3d1db3f264984be229717fe26520e21585e0eb9f..0000000000000000000000000000000000000000
--- a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/signin/AccountsChangedReceiver.java
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2013 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.testshell.signin;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-
-import org.chromium.base.ThreadUtils;
-import org.chromium.base.library_loader.ProcessInitException;
-import org.chromium.chrome.browser.profiles.Profile;
-import org.chromium.chrome.browser.signin.OAuth2TokenService;
-import org.chromium.content.browser.BrowserStartupController;
-import org.chromium.sync.signin.ChromeSigninController;
-
-/**
- * A BroadcastReceiver for acting on changes to Android accounts.
- */
-public class AccountsChangedReceiver extends BroadcastReceiver {
- private static final String TAG = "AccountsChangedReceiver";
-
- @Override
- public void onReceive(final Context context, Intent intent) {
- if (AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION.equals(intent.getAction())) {
- final Account signedInUser =
- ChromeSigninController.get(context).getSignedInUser();
- if (signedInUser != null) {
- BrowserStartupController.StartupCallback callback =
- new BrowserStartupController.StartupCallback() {
- @Override
- public void onSuccess(boolean alreadyStarted) {
- OAuth2TokenService.getForProfile(Profile.getLastUsedProfile())
- .validateAccounts(context);
- }
-
- @Override
- public void onFailure() {
- Log.w(TAG, "Failed to start browser process.");
- }
- };
- startBrowserProcessOnUiThread(context, callback);
- }
- }
- }
-
- private static void startBrowserProcessOnUiThread(final Context context,
- final BrowserStartupController.StartupCallback callback) {
- ThreadUtils.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- try {
- BrowserStartupController.get(context).startBrowserProcessesAsync(callback);
- }
- catch (ProcessInitException e) {
- Log.e(TAG, "Unable to load native library.", e);
- System.exit(-1);
- }
- }
- });
- }
-}

Powered by Google App Engine
This is Rietveld 408576698