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.invalidation; | 5 package org.chromium.chrome.browser.invalidation; |
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; |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 public ChromeBrowserSyncAdapter(Context context, Application application) { | 40 public ChromeBrowserSyncAdapter(Context context, Application application) { |
41 super(context, false); | 41 super(context, false); |
42 mApplication = application; | 42 mApplication = application; |
43 } | 43 } |
44 | 44 |
45 @Override | 45 @Override |
46 public void onPerformSync(Account account, Bundle extras, String authority, | 46 public void onPerformSync(Account account, Bundle extras, String authority, |
47 ContentProviderClient provider, SyncResult syncResult) { | 47 ContentProviderClient provider, SyncResult syncResult) { |
48 if (extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE)) { | 48 if (extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE)) { |
49 Account signedInAccount = ChromeSigninController.get(getContext()).g
etSignedInUser(); | 49 Account signedInAccount = ChromeSigninController.get().getSignedInUs
er(); |
50 if (account.equals(signedInAccount)) { | 50 if (account.equals(signedInAccount)) { |
51 ContentResolver.setIsSyncable(account, authority, 1); | 51 ContentResolver.setIsSyncable(account, authority, 1); |
52 } else { | 52 } else { |
53 ContentResolver.setIsSyncable(account, authority, 0); | 53 ContentResolver.setIsSyncable(account, authority, 0); |
54 } | 54 } |
55 return; | 55 return; |
56 } | 56 } |
57 PendingInvalidation invalidation = new PendingInvalidation(extras); | 57 PendingInvalidation invalidation = new PendingInvalidation(extras); |
58 | 58 |
59 DelayedInvalidationsController controller = DelayedInvalidationsControll
er.getInstance(); | 59 DelayedInvalidationsController controller = DelayedInvalidationsControll
er.getInstance(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 }; | 135 }; |
136 } | 136 } |
137 | 137 |
138 @VisibleForTesting | 138 @VisibleForTesting |
139 public void notifyInvalidation( | 139 public void notifyInvalidation( |
140 int objectSource, String objectId, long version, String payload) { | 140 int objectSource, String objectId, long version, String payload) { |
141 InvalidationServiceFactory.getForProfile(Profile.getLastUsedProfile()) | 141 InvalidationServiceFactory.getForProfile(Profile.getLastUsedProfile()) |
142 .notifyInvalidationToNativeChrome(objectSource, objectId, versio
n, payload); | 142 .notifyInvalidationToNativeChrome(objectSource, objectId, versio
n, payload); |
143 } | 143 } |
144 } | 144 } |
OLD | NEW |