OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.sync; | 5 package org.chromium.chrome.browser.sync; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.app.Application; | 8 import android.app.Application; |
9 import android.content.AbstractThreadedSyncAdapter; | 9 import android.content.AbstractThreadedSyncAdapter; |
10 import android.content.ContentProviderClient; | 10 import android.content.ContentProviderClient; |
11 import android.content.Context; | 11 import android.content.Context; |
12 import android.content.SyncResult; | 12 import android.content.SyncResult; |
13 import android.os.Bundle; | 13 import android.os.Bundle; |
14 import android.os.Handler; | 14 import android.os.Handler; |
15 import android.util.Log; | 15 import android.util.Log; |
16 | 16 |
17 import com.google.protos.ipc.invalidation.Types; | 17 import com.google.protos.ipc.invalidation.Types; |
18 | 18 |
19 import org.chromium.base.ThreadUtils; | 19 import org.chromium.base.ThreadUtils; |
20 import org.chromium.base.VisibleForTesting; | 20 import org.chromium.base.VisibleForTesting; |
21 import org.chromium.base.library_loader.ProcessInitException; | 21 import org.chromium.base.library_loader.ProcessInitException; |
| 22 import org.chromium.chrome.browser.invalidation.InvalidationServiceFactory; |
| 23 import org.chromium.chrome.browser.profiles.Profile; |
22 import org.chromium.content.browser.BrowserStartupController; | 24 import org.chromium.content.browser.BrowserStartupController; |
23 | 25 |
24 import java.util.concurrent.Semaphore; | 26 import java.util.concurrent.Semaphore; |
25 | 27 |
26 /** | 28 /** |
27 * A sync adapter for Chromium. | 29 * A sync adapter for Chromium. |
28 */ | 30 */ |
29 public abstract class ChromiumSyncAdapter extends AbstractThreadedSyncAdapter { | 31 public abstract class ChromiumSyncAdapter extends AbstractThreadedSyncAdapter { |
30 private static final String TAG = "ChromiumSyncAdapter"; | 32 private static final String TAG = "ChromiumSyncAdapter"; |
31 | 33 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 DelayedSyncController.getInstance().setDelayedSync(context, acct
.name); | 162 DelayedSyncController.getInstance().setDelayedSync(context, acct
.name); |
161 // Using numIoExceptions so Android will treat this as a soft er
ror. | 163 // Using numIoExceptions so Android will treat this as a soft er
ror. |
162 syncResult.stats.numIoExceptions++; | 164 syncResult.stats.numIoExceptions++; |
163 semaphore.release(); | 165 semaphore.release(); |
164 } | 166 } |
165 }; | 167 }; |
166 } | 168 } |
167 | 169 |
168 @VisibleForTesting | 170 @VisibleForTesting |
169 public void requestSync(int objectSource, String objectId, long version, Str
ing payload) { | 171 public void requestSync(int objectSource, String objectId, long version, Str
ing payload) { |
170 ProfileSyncService.get(mApplication) | 172 InvalidationServiceFactory.getForProfile(Profile.getLastUsedProfile()) |
171 .requestSyncFromNativeChrome(objectSource, objectId, version, pa
yload); | 173 .requestSyncFromNativeChrome(objectSource, objectId, version, pa
yload); |
172 } | 174 } |
173 | 175 |
174 @VisibleForTesting | 176 @VisibleForTesting |
175 public void requestSyncForAllTypes() { | 177 public void requestSyncForAllTypes() { |
176 ProfileSyncService.get(mApplication).requestSyncFromNativeChromeForAllTy
pes(); | 178 InvalidationServiceFactory.getForProfile(Profile.getLastUsedProfile()) |
| 179 .requestSyncFromNativeChromeForAllTypes(); |
177 } | 180 } |
178 } | 181 } |
OLD | NEW |