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.common.annotations.VisibleForTesting; | 17 import com.google.common.annotations.VisibleForTesting; |
18 import com.google.protos.ipc.invalidation.Types; | 18 import com.google.protos.ipc.invalidation.Types; |
19 | 19 |
20 import org.chromium.base.ThreadUtils; | 20 import org.chromium.base.ThreadUtils; |
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 DelayedSyncController.getInstance().setDelayedSync(context, acct
.name); | 163 DelayedSyncController.getInstance().setDelayedSync(context, acct
.name); |
162 // Using numIoExceptions so Android will treat this as a soft er
ror. | 164 // Using numIoExceptions so Android will treat this as a soft er
ror. |
163 syncResult.stats.numIoExceptions++; | 165 syncResult.stats.numIoExceptions++; |
164 semaphore.release(); | 166 semaphore.release(); |
165 } | 167 } |
166 }; | 168 }; |
167 } | 169 } |
168 | 170 |
169 @VisibleForTesting | 171 @VisibleForTesting |
170 public void requestSync(int objectSource, String objectId, long version, Str
ing payload) { | 172 public void requestSync(int objectSource, String objectId, long version, Str
ing payload) { |
171 ProfileSyncService.get(mApplication) | 173 InvalidationServiceFactory.getForProfile(Profile.getLastUsedProfile()) |
172 .requestSyncFromNativeChrome(objectSource, objectId, version, pa
yload); | 174 .requestSyncFromNativeChrome(objectSource, objectId, version, pa
yload); |
173 } | 175 } |
174 | 176 |
175 @VisibleForTesting | 177 @VisibleForTesting |
176 public void requestSyncForAllTypes() { | 178 public void requestSyncForAllTypes() { |
177 ProfileSyncService.get(mApplication).requestSyncFromNativeChromeForAllTy
pes(); | 179 InvalidationServiceFactory.getForProfile(Profile.getLastUsedProfile()) |
| 180 .requestSyncFromNativeChromeForAllTypes(); |
178 } | 181 } |
179 } | 182 } |
OLD | NEW |