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

Side by Side Diff: chrome/browser/sync/profile_sync_service_android.h

Issue 1247853007: [Sync] Add auto-generated ModelType in Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add SYNC_EXPORT and rebase. Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 GetSyncEnterCustomPassphraseBodyText( 135 GetSyncEnterCustomPassphraseBodyText(
136 JNIEnv* env, jobject); 136 JNIEnv* env, jobject);
137 137
138 // Returns true if sync has been migrated. 138 // Returns true if sync has been migrated.
139 jboolean IsSyncKeystoreMigrationDone(JNIEnv* env, jobject obj); 139 jboolean IsSyncKeystoreMigrationDone(JNIEnv* env, jobject obj);
140 140
141 // Get the set of active data types. These are the types currently being 141 // Get the set of active data types. These are the types currently being
142 // synced. Note that control types are always included here. 142 // synced. Note that control types are always included here.
143 // Returns a bit map of the values from 143 // Returns a bit map of the values from
144 // profile_sync_service_android.cc. 144 // profile_sync_service_android.cc.
145 jlong GetActiveDataTypes(JNIEnv* env, jobject obj); 145 base::android::ScopedJavaLocalRef<jintArray> GetActiveDataTypes(JNIEnv* env,
146 jobject obj);
146 147
147 // Get the set of preferred data types. These are the types that the user 148 // Get the set of preferred data types. These are the types that the user
148 // has requested be synced. 149 // has requested be synced.
149 // Returns a bit map of the values from 150 // Returns a bit map of the values from
150 // profile_sync_service_android.cc. 151 // profile_sync_service_android.cc.
151 jlong GetPreferredDataTypes(JNIEnv* env, jobject obj); 152 base::android::ScopedJavaLocalRef<jintArray> GetPreferredDataTypes(
153 JNIEnv* env,
154 jobject obj);
152 155
153 // Enables the passed data types. 156 // Enables the passed data types.
154 // If |sync_everything| is true, then all data types are enabled and the 157 // If |sync_everything| is true, then all data types are enabled and the
155 // contents of |model_type_selection| is 158 // contents of |model_type_selection| is
156 // ignored. 159 // ignored.
157 // Otherwise, the values of |model_type_selection| must contain a bit map of 160 // Otherwise, the values of |model_type_selection| must contain a bit map of
158 // values from profile_sync_service_android.cc. 161 // values from profile_sync_service_android.cc.
159 void SetPreferredDataTypes(JNIEnv* env, 162 void SetPreferredDataTypes(JNIEnv* env,
160 jobject obj, 163 jobject obj,
161 jboolean sync_everything, 164 jboolean sync_everything,
162 jlong model_type_selection); 165 jintArray model_type_selection);
163 166
164 // Tells sync that we're currently configuring so no data types should be 167 // Tells sync that we're currently configuring so no data types should be
165 // downloaded yet. 168 // downloaded yet.
166 void SetSetupInProgress(JNIEnv* env, jobject obj, jboolean in_progress); 169 void SetSetupInProgress(JNIEnv* env, jobject obj, jboolean in_progress);
167 170
168 // Tells sync that sync setup is complete so we can start syncing now. 171 // Tells sync that sync setup is complete so we can start syncing now.
169 void SetSyncSetupCompleted(JNIEnv* env, jobject obj); 172 void SetSyncSetupCompleted(JNIEnv* env, jobject obj);
170 173
171 // Returns true if sync setup has been completed. 174 // Returns true if sync setup has been completed.
172 jboolean HasSyncSetupCompleted(JNIEnv* env, jobject obj); 175 jboolean HasSyncSetupCompleted(JNIEnv* env, jobject obj);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // the internal value of base::Time. 210 // the internal value of base::Time.
208 jlong GetLastSyncedTimeForTest(JNIEnv* env, jobject obj); 211 jlong GetLastSyncedTimeForTest(JNIEnv* env, jobject obj);
209 212
210 // Overrides ProfileSyncService's NetworkResources object. This is used to 213 // Overrides ProfileSyncService's NetworkResources object. This is used to
211 // set up the Sync FakeServer for testing. 214 // set up the Sync FakeServer for testing.
212 void OverrideNetworkResourcesForTest(JNIEnv* env, 215 void OverrideNetworkResourcesForTest(JNIEnv* env,
213 jobject obj, 216 jobject obj,
214 jlong network_resources); 217 jlong network_resources);
215 218
216 // Public for tests. 219 // Public for tests.
217 static jlong ModelTypeSetToSelection(syncer::ModelTypeSet model_types); 220 static base::android::ScopedJavaLocalRef<jintArray>
218 221 ModelTypeSetToJavaIntArray(JNIEnv* env, syncer::ModelTypeSet model_types);
219 // Converts a bitmap of model types to a set of Java ModelTypes, and returns
220 // their string descriptions separated by commas.
221 static std::string ModelTypeSelectionToStringForTest(
222 jlong model_type_selection);
223 222
224 static ProfileSyncServiceAndroid* GetProfileSyncServiceAndroid(); 223 static ProfileSyncServiceAndroid* GetProfileSyncServiceAndroid();
225 224
226 // Registers the ProfileSyncServiceAndroid's native methods through JNI. 225 // Registers the ProfileSyncServiceAndroid's native methods through JNI.
227 static bool Register(JNIEnv* env); 226 static bool Register(JNIEnv* env);
228 227
229 private: 228 private:
230 typedef std::map<invalidation::ObjectId, 229 typedef std::map<invalidation::ObjectId,
231 int64, 230 int64,
232 syncer::ObjectIdLessThan> ObjectIdVersionMap; 231 syncer::ObjectIdLessThan> ObjectIdVersionMap;
233 232
234 ~ProfileSyncServiceAndroid() override; 233 ~ProfileSyncServiceAndroid() override;
235 // Remove observers to profile sync service. 234 // Remove observers to profile sync service.
236 void RemoveObserver(); 235 void RemoveObserver();
237 236
238 Profile* profile_; 237 Profile* profile_;
239 ProfileSyncService* sync_service_; 238 ProfileSyncService* sync_service_;
240 // The class that handles getting, setting, and persisting sync 239 // The class that handles getting, setting, and persisting sync
241 // preferences. 240 // preferences.
242 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_; 241 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_;
243 242
244 // Java-side ProfileSyncService object. 243 // Java-side ProfileSyncService object.
245 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; 244 JavaObjectWeakGlobalRef weak_java_profile_sync_service_;
246 245
247 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); 246 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid);
248 }; 247 };
249 248
250 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ 249 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698