| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.chrome.browser.services; | 5 package org.chromium.chrome.browser.services; |
| 6 | 6 |
| 7 import android.accounts.AccountManager; | 7 import android.accounts.AccountManager; |
| 8 import android.content.BroadcastReceiver; | 8 import android.content.BroadcastReceiver; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 @Override | 82 @Override |
| 83 protected void onPostExecute(Void result) { | 83 protected void onPostExecute(Void result) { |
| 84 continueHandleAccountChangeIfNeeded(appContext); | 84 continueHandleAccountChangeIfNeeded(appContext); |
| 85 } | 85 } |
| 86 }; | 86 }; |
| 87 task.execute(); | 87 task.execute(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 private void continueHandleAccountChangeIfNeeded(final Context context) { | 90 private void continueHandleAccountChangeIfNeeded(final Context context) { |
| 91 AccountTrackerService.get(context).invalidateAccountSeedStatus( | 91 AccountTrackerService.get().invalidateAccountSeedStatus( |
| 92 false /* don't refresh right now */); | 92 false /* don't refresh right now */); |
| 93 boolean isChromeVisible = ApplicationStatus.hasVisibleActivities(); | 93 boolean isChromeVisible = ApplicationStatus.hasVisibleActivities(); |
| 94 if (isChromeVisible) { | 94 if (isChromeVisible) { |
| 95 startBrowserIfNeededAndValidateAccounts(context); | 95 startBrowserIfNeededAndValidateAccounts(context); |
| 96 } else { | 96 } else { |
| 97 // Notify SigninHelper of changed accounts (via shared prefs). | 97 // Notify SigninHelper of changed accounts (via shared prefs). |
| 98 SigninHelper.markAccountsChangedPref(context); | 98 SigninHelper.markAccountsChangedPref(context); |
| 99 } | 99 } |
| 100 notifyAccountsChangedOnBrowserStartup(context); | 100 notifyAccountsChangedOnBrowserStartup(context); |
| 101 } | 101 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 public void onFailure() { | 142 public void onFailure() { |
| 143 // Startup failed, so ignore call. | 143 // Startup failed, so ignore call. |
| 144 } | 144 } |
| 145 }; | 145 }; |
| 146 // If the browser process has already been loaded, a task will be posted
immediately to | 146 // If the browser process has already been loaded, a task will be posted
immediately to |
| 147 // call the |notifyAccountsChangedCallback| passed in as a parameter. | 147 // call the |notifyAccountsChangedCallback| passed in as a parameter. |
| 148 BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER) | 148 BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER) |
| 149 .addStartupCompletedObserver(notifyAccountsChangedCallback); | 149 .addStartupCompletedObserver(notifyAccountsChangedCallback); |
| 150 } | 150 } |
| 151 } | 151 } |
| OLD | NEW |