Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / sync / profile_sync_service_android.cc
blob711452da6abcc954a61134c966e28b2e1009fa40
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
3 // found in the LICENSE file.
5 #include "chrome/browser/sync/profile_sync_service_android.h"
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
9 #include "base/bind.h"
10 #include "base/i18n/time_formatting.h"
11 #include "base/json/json_writer.h"
12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/metrics/field_trial.h"
15 #include "base/prefs/pref_service.h"
16 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h"
18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/signin/signin_manager_factory.h"
21 #include "chrome/browser/sync/about_sync_util.h"
22 #include "chrome/browser/sync/profile_sync_service.h"
23 #include "chrome/browser/sync/profile_sync_service_factory.h"
24 #include "chrome/browser/sync/sync_ui_util.h"
25 #include "chrome/grit/generated_resources.h"
26 #include "components/signin/core/browser/signin_manager.h"
27 #include "components/sync_driver/pref_names.h"
28 #include "components/sync_driver/sync_prefs.h"
29 #include "content/public/browser/browser_thread.h"
30 #include "google/cacheinvalidation/types.pb.h"
31 #include "google_apis/gaia/gaia_constants.h"
32 #include "google_apis/gaia/google_service_auth_error.h"
33 #include "jni/ProfileSyncService_jni.h"
34 #include "sync/internal_api/public/network_resources.h"
35 #include "sync/internal_api/public/read_transaction.h"
36 #include "ui/base/l10n/l10n_util.h"
38 using base::android::AttachCurrentThread;
39 using base::android::CheckException;
40 using base::android::ConvertJavaStringToUTF8;
41 using base::android::ConvertUTF8ToJavaString;
42 using base::android::ScopedJavaLocalRef;
43 using content::BrowserThread;
45 namespace {
47 // This enum contains the list of sync ModelTypes that Android can register for
48 // invalidations for.
50 // A Java counterpart will be generated for this enum.
51 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.sync
52 enum ModelTypeSelection {
53 AUTOFILL = 1 << 0,
54 BOOKMARK = 1 << 1,
55 PASSWORD = 1 << 2,
56 SESSION = 1 << 3,
57 TYPED_URL = 1 << 4,
58 AUTOFILL_PROFILE = 1 << 5,
59 HISTORY_DELETE_DIRECTIVE = 1 << 6,
60 PROXY_TABS = 1 << 7,
61 FAVICON_IMAGE = 1 << 8,
62 FAVICON_TRACKING = 1 << 9,
63 NIGORI = 1 << 10,
64 DEVICE_INFO = 1 << 11,
65 EXPERIMENTS = 1 << 12,
66 SUPERVISED_USER_SETTING = 1 << 13,
67 SUPERVISED_USER_WHITELIST = 1 << 14,
68 AUTOFILL_WALLET = 1 << 15,
69 AUTOFILL_WALLET_METADATA = 1 << 16,
70 PREFERENCE = 1 << 17,
71 PRIORITY_PREFERENCE = 1 << 18,
74 // Native callback for the JNI GetAllNodes method. When
75 // ProfileSyncService::GetAllNodes completes, this method is called and the
76 // results are sent to the Java callback.
77 void NativeGetAllNodesCallback(
78 const base::android::ScopedJavaGlobalRef<jobject>& callback,
79 scoped_ptr<base::ListValue> result) {
80 JNIEnv* env = base::android::AttachCurrentThread();
81 std::string json_string;
82 if (!result.get() || !base::JSONWriter::Write(*result, &json_string)) {
83 DVLOG(1) << "Writing as JSON failed. Passing empty string to Java code.";
84 json_string = std::string();
87 ScopedJavaLocalRef<jstring> java_json_string =
88 ConvertUTF8ToJavaString(env, json_string);
89 Java_ProfileSyncService_onGetAllNodesResult(env,
90 callback.obj(),
91 java_json_string.obj());
94 } // namespace
96 ProfileSyncServiceAndroid::ProfileSyncServiceAndroid(JNIEnv* env, jobject obj)
97 : profile_(NULL),
98 sync_service_(NULL),
99 weak_java_profile_sync_service_(env, obj) {
100 if (g_browser_process == NULL ||
101 g_browser_process->profile_manager() == NULL) {
102 NOTREACHED() << "Browser process or profile manager not initialized";
103 return;
106 profile_ = ProfileManager::GetActiveUserProfile();
107 if (profile_ == NULL) {
108 NOTREACHED() << "Sync Init: Profile not found.";
109 return;
112 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs()));
114 sync_service_ =
115 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
116 DCHECK(sync_service_);
119 void ProfileSyncServiceAndroid::Init() {
120 sync_service_->AddObserver(this);
123 void ProfileSyncServiceAndroid::RemoveObserver() {
124 if (sync_service_->HasObserver(this)) {
125 sync_service_->RemoveObserver(this);
129 ProfileSyncServiceAndroid::~ProfileSyncServiceAndroid() {
130 RemoveObserver();
133 void ProfileSyncServiceAndroid::OnStateChanged() {
134 // Notify the java world that our sync state has changed.
135 JNIEnv* env = AttachCurrentThread();
136 Java_ProfileSyncService_syncStateChanged(
137 env, weak_java_profile_sync_service_.get(env).obj());
140 jboolean ProfileSyncServiceAndroid::IsPassphrasePrompted(JNIEnv* env,
141 jobject obj) {
142 const std::string group_name =
143 base::FieldTrialList::FindFullName("LimitSyncPassphrasePrompt");
144 if (group_name != "Enabled")
145 return false;
146 return sync_prefs_->IsPassphrasePrompted();
149 void ProfileSyncServiceAndroid::SetPassphrasePrompted(JNIEnv* env,
150 jobject obj,
151 jboolean prompted) {
152 sync_prefs_->SetPassphrasePrompted(prompted);
155 void ProfileSyncServiceAndroid::RequestStart(JNIEnv* env, jobject) {
156 DCHECK_CURRENTLY_ON(BrowserThread::UI);
157 sync_service_->RequestStart();
160 void ProfileSyncServiceAndroid::RequestStop(JNIEnv* env, jobject) {
161 DCHECK_CURRENTLY_ON(BrowserThread::UI);
162 sync_service_->RequestStop(ProfileSyncService::KEEP_DATA);
165 void ProfileSyncServiceAndroid::SignOutSync(JNIEnv* env, jobject) {
166 DCHECK_CURRENTLY_ON(BrowserThread::UI);
167 DCHECK(profile_);
168 sync_service_->RequestStop(ProfileSyncService::CLEAR_DATA);
171 void ProfileSyncServiceAndroid::FlushDirectory(JNIEnv* env, jobject) {
172 DCHECK_CURRENTLY_ON(BrowserThread::UI);
173 sync_service_->FlushDirectory();
176 ScopedJavaLocalRef<jstring> ProfileSyncServiceAndroid::QuerySyncStatusSummary(
177 JNIEnv* env, jobject) {
178 DCHECK_CURRENTLY_ON(BrowserThread::UI);
179 DCHECK(profile_);
180 std::string status(sync_service_->QuerySyncStatusSummaryString());
181 return ConvertUTF8ToJavaString(env, status);
184 void ProfileSyncServiceAndroid::GetAllNodes(JNIEnv* env,
185 jobject obj,
186 jobject callback) {
187 base::android::ScopedJavaGlobalRef<jobject> java_callback;
188 java_callback.Reset(env, callback);
190 base::Callback<void(scoped_ptr<base::ListValue>)> native_callback =
191 base::Bind(&NativeGetAllNodesCallback, java_callback);
192 sync_service_->GetAllNodes(native_callback);
195 void ProfileSyncServiceAndroid::SetSyncSessionsId(
196 JNIEnv* env, jobject obj, jstring tag) {
197 DCHECK_CURRENTLY_ON(BrowserThread::UI);
198 DCHECK(profile_);
199 std::string machine_tag = ConvertJavaStringToUTF8(env, tag);
200 sync_prefs_->SetSyncSessionsGUID(machine_tag);
203 jint ProfileSyncServiceAndroid::GetAuthError(JNIEnv* env, jobject) {
204 DCHECK_CURRENTLY_ON(BrowserThread::UI);
205 return sync_service_->GetAuthError().state();
208 jboolean ProfileSyncServiceAndroid::IsEncryptEverythingEnabled(
209 JNIEnv* env, jobject) {
210 DCHECK_CURRENTLY_ON(BrowserThread::UI);
211 return sync_service_->EncryptEverythingEnabled();
214 jboolean ProfileSyncServiceAndroid::IsSyncInitialized(JNIEnv* env, jobject) {
215 DCHECK_CURRENTLY_ON(BrowserThread::UI);
216 return sync_service_->backend_initialized();
219 jboolean ProfileSyncServiceAndroid::IsFirstSetupInProgress(
220 JNIEnv* env, jobject) {
221 DCHECK_CURRENTLY_ON(BrowserThread::UI);
222 return sync_service_->FirstSetupInProgress();
225 jboolean ProfileSyncServiceAndroid::IsEncryptEverythingAllowed(
226 JNIEnv* env, jobject obj) {
227 DCHECK_CURRENTLY_ON(BrowserThread::UI);
228 return sync_service_->EncryptEverythingAllowed();
231 jboolean ProfileSyncServiceAndroid::IsPassphraseRequired(JNIEnv* env, jobject) {
232 DCHECK_CURRENTLY_ON(BrowserThread::UI);
233 return sync_service_->IsPassphraseRequired();
236 jboolean ProfileSyncServiceAndroid::IsPassphraseRequiredForDecryption(
237 JNIEnv* env, jobject obj) {
238 DCHECK_CURRENTLY_ON(BrowserThread::UI);
239 // In case of CUSTOM_PASSPHRASE we always sync passwords. Prompt the user for
240 // a passphrase if cryptographer has any pending keys.
241 if (sync_service_->GetPassphraseType() == syncer::CUSTOM_PASSPHRASE) {
242 return !IsCryptographerReady(env, obj);
244 if (sync_service_->IsPassphraseRequiredForDecryption()) {
245 // Passwords datatype should never prompt for a passphrase, except when
246 // user is using a custom passphrase. Do not prompt for a passphrase if
247 // passwords are the only encrypted datatype. This prevents a temporary
248 // notification for passphrase when PSS has not completed configuring
249 // DataTypeManager, after configuration password datatype shall be disabled.
250 const syncer::ModelTypeSet encrypted_types =
251 sync_service_->GetEncryptedDataTypes();
252 return !encrypted_types.Equals(syncer::ModelTypeSet(syncer::PASSWORDS));
254 return false;
257 jboolean ProfileSyncServiceAndroid::IsPassphraseRequiredForExternalType(
258 JNIEnv* env, jobject) {
259 DCHECK_CURRENTLY_ON(BrowserThread::UI);
260 return
261 sync_service_->passphrase_required_reason() == syncer::REASON_DECRYPTION;
264 jboolean ProfileSyncServiceAndroid::IsUsingSecondaryPassphrase(
265 JNIEnv* env, jobject) {
266 DCHECK_CURRENTLY_ON(BrowserThread::UI);
267 return sync_service_->IsUsingSecondaryPassphrase();
270 jboolean ProfileSyncServiceAndroid::SetDecryptionPassphrase(
271 JNIEnv* env, jobject obj, jstring passphrase) {
272 DCHECK_CURRENTLY_ON(BrowserThread::UI);
273 std::string key = ConvertJavaStringToUTF8(env, passphrase);
274 return sync_service_->SetDecryptionPassphrase(key);
277 void ProfileSyncServiceAndroid::SetEncryptionPassphrase(
278 JNIEnv* env, jobject obj, jstring passphrase) {
279 DCHECK_CURRENTLY_ON(BrowserThread::UI);
280 std::string key = ConvertJavaStringToUTF8(env, passphrase);
281 sync_service_->SetEncryptionPassphrase(key, ProfileSyncService::EXPLICIT);
284 jboolean ProfileSyncServiceAndroid::IsCryptographerReady(JNIEnv* env, jobject) {
285 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
286 return sync_service_->IsCryptographerReady(&trans);
289 jint ProfileSyncServiceAndroid::GetPassphraseType(JNIEnv* env, jobject) {
290 DCHECK_CURRENTLY_ON(BrowserThread::UI);
291 return sync_service_->GetPassphraseType();
294 jboolean ProfileSyncServiceAndroid::HasExplicitPassphraseTime(
295 JNIEnv* env, jobject) {
296 DCHECK_CURRENTLY_ON(BrowserThread::UI);
297 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime();
298 return !passphrase_time.is_null();
301 jlong ProfileSyncServiceAndroid::GetExplicitPassphraseTime(
302 JNIEnv* env, jobject) {
303 DCHECK_CURRENTLY_ON(BrowserThread::UI);
304 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime();
305 return passphrase_time.ToJavaTime();
308 ScopedJavaLocalRef<jstring>
309 ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText(
310 JNIEnv* env, jobject) {
311 DCHECK_CURRENTLY_ON(BrowserThread::UI);
312 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime();
313 base::string16 passphrase_time_str =
314 base::TimeFormatShortDate(passphrase_time);
315 return base::android::ConvertUTF16ToJavaString(env,
316 l10n_util::GetStringFUTF16(
317 IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE,
318 passphrase_time_str));
321 ScopedJavaLocalRef<jstring>
322 ProfileSyncServiceAndroid::GetSyncEnterCustomPassphraseBodyWithDateText(
323 JNIEnv* env, jobject) {
324 DCHECK_CURRENTLY_ON(BrowserThread::UI);
325 base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime();
326 base::string16 passphrase_time_str =
327 base::TimeFormatShortDate(passphrase_time);
328 return base::android::ConvertUTF16ToJavaString(env,
329 l10n_util::GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE,
330 passphrase_time_str));
333 ScopedJavaLocalRef<jstring>
334 ProfileSyncServiceAndroid::GetCurrentSignedInAccountText(
335 JNIEnv* env, jobject) {
336 DCHECK_CURRENTLY_ON(BrowserThread::UI);
337 const std::string& sync_username =
338 SigninManagerFactory::GetForProfile(profile_)->GetAuthenticatedUsername();
339 return base::android::ConvertUTF16ToJavaString(env,
340 l10n_util::GetStringFUTF16(
341 IDS_SYNC_ACCOUNT_SYNCING_TO_USER,
342 base::ASCIIToUTF16(sync_username)));
345 ScopedJavaLocalRef<jstring>
346 ProfileSyncServiceAndroid::GetSyncEnterCustomPassphraseBodyText(
347 JNIEnv* env, jobject) {
348 DCHECK_CURRENTLY_ON(BrowserThread::UI);
349 return ConvertUTF8ToJavaString(
350 env, l10n_util::GetStringUTF8(IDS_SYNC_ENTER_PASSPHRASE_BODY));
353 jboolean ProfileSyncServiceAndroid::IsSyncKeystoreMigrationDone(
354 JNIEnv* env, jobject) {
355 DCHECK_CURRENTLY_ON(BrowserThread::UI);
356 syncer::SyncStatus status;
357 bool is_status_valid = sync_service_->QueryDetailedSyncStatus(&status);
358 return is_status_valid && !status.keystore_migration_time.is_null();
361 jlong ProfileSyncServiceAndroid::GetActiveDataTypes(
362 JNIEnv* env, jobject obj) {
363 syncer::ModelTypeSet types = sync_service_->GetActiveDataTypes();
364 types.PutAll(syncer::ControlTypes());
365 return ModelTypeSetToSelection(types);
368 jlong ProfileSyncServiceAndroid::GetPreferredDataTypes(
369 JNIEnv* env, jobject obj) {
370 syncer::ModelTypeSet types = sync_service_->GetPreferredDataTypes();
371 types.PutAll(syncer::ControlTypes());
372 return ModelTypeSetToSelection(types);
375 void ProfileSyncServiceAndroid::SetPreferredDataTypes(
376 JNIEnv* env, jobject obj,
377 jboolean sync_everything,
378 jlong model_type_selection) {
379 DCHECK_CURRENTLY_ON(BrowserThread::UI);
380 syncer::ModelTypeSet types;
381 // Note: only user selectable types should be included here.
382 if (model_type_selection & AUTOFILL)
383 types.Put(syncer::AUTOFILL);
384 if (model_type_selection & BOOKMARK)
385 types.Put(syncer::BOOKMARKS);
386 if (model_type_selection & PASSWORD)
387 types.Put(syncer::PASSWORDS);
388 if (model_type_selection & PROXY_TABS)
389 types.Put(syncer::PROXY_TABS);
390 if (model_type_selection & TYPED_URL)
391 types.Put(syncer::TYPED_URLS);
392 if (model_type_selection & PREFERENCE)
393 types.Put(syncer::PREFERENCES);
394 DCHECK(syncer::UserSelectableTypes().HasAll(types));
395 sync_service_->OnUserChoseDatatypes(sync_everything, types);
398 void ProfileSyncServiceAndroid::SetSetupInProgress(
399 JNIEnv* env, jobject obj, jboolean in_progress) {
400 DCHECK_CURRENTLY_ON(BrowserThread::UI);
401 sync_service_->SetSetupInProgress(in_progress);
404 void ProfileSyncServiceAndroid::SetSyncSetupCompleted(
405 JNIEnv* env, jobject obj) {
406 DCHECK_CURRENTLY_ON(BrowserThread::UI);
407 sync_service_->SetSyncSetupCompleted();
410 jboolean ProfileSyncServiceAndroid::HasSyncSetupCompleted(
411 JNIEnv* env, jobject obj) {
412 DCHECK_CURRENTLY_ON(BrowserThread::UI);
413 return sync_service_->HasSyncSetupCompleted();
416 jboolean ProfileSyncServiceAndroid::IsSyncRequested(
417 JNIEnv* env, jobject obj) {
418 DCHECK_CURRENTLY_ON(BrowserThread::UI);
419 return sync_service_->IsSyncRequested();
422 jboolean ProfileSyncServiceAndroid::IsSyncActive(JNIEnv* env, jobject obj) {
423 DCHECK_CURRENTLY_ON(BrowserThread::UI);
424 return sync_service_->IsSyncActive();
427 void ProfileSyncServiceAndroid::EnableEncryptEverything(
428 JNIEnv* env, jobject obj) {
429 DCHECK_CURRENTLY_ON(BrowserThread::UI);
430 sync_service_->EnableEncryptEverything();
433 jboolean ProfileSyncServiceAndroid::HasKeepEverythingSynced(
434 JNIEnv* env, jobject) {
435 DCHECK_CURRENTLY_ON(BrowserThread::UI);
436 return sync_prefs_->HasKeepEverythingSynced();
439 jboolean ProfileSyncServiceAndroid::HasUnrecoverableError(
440 JNIEnv* env, jobject) {
441 DCHECK_CURRENTLY_ON(BrowserThread::UI);
442 return sync_service_->HasUnrecoverableError();
445 ScopedJavaLocalRef<jstring> ProfileSyncServiceAndroid::GetAboutInfoForTest(
446 JNIEnv* env, jobject) {
447 DCHECK_CURRENTLY_ON(BrowserThread::UI);
449 scoped_ptr<base::DictionaryValue> about_info =
450 sync_ui_util::ConstructAboutInformation(sync_service_);
451 std::string about_info_json;
452 base::JSONWriter::Write(*about_info, &about_info_json);
454 return ConvertUTF8ToJavaString(env, about_info_json);
457 jlong ProfileSyncServiceAndroid::GetLastSyncedTimeForTest(
458 JNIEnv* env, jobject obj) {
459 // Use profile preferences here instead of SyncPrefs to avoid an extra
460 // conversion, since SyncPrefs::GetLastSyncedTime() converts the stored value
461 // to to base::Time.
462 return static_cast<jlong>(
463 profile_->GetPrefs()->GetInt64(sync_driver::prefs::kSyncLastSyncedTime));
466 void ProfileSyncServiceAndroid::OverrideNetworkResourcesForTest(
467 JNIEnv* env,
468 jobject obj,
469 jlong network_resources) {
470 syncer::NetworkResources* resources =
471 reinterpret_cast<syncer::NetworkResources*>(network_resources);
472 sync_service_->OverrideNetworkResourcesForTest(
473 make_scoped_ptr<syncer::NetworkResources>(resources));
476 // static
477 jlong ProfileSyncServiceAndroid::ModelTypeSetToSelection(
478 syncer::ModelTypeSet types) {
479 jlong model_type_selection = 0;
480 if (types.Has(syncer::BOOKMARKS)) {
481 model_type_selection |= BOOKMARK;
483 if (types.Has(syncer::AUTOFILL)) {
484 model_type_selection |= AUTOFILL;
486 if (types.Has(syncer::AUTOFILL_PROFILE)) {
487 model_type_selection |= AUTOFILL_PROFILE;
489 if (types.Has(syncer::AUTOFILL_WALLET_DATA)) {
490 model_type_selection |= AUTOFILL_WALLET;
492 if (types.Has(syncer::AUTOFILL_WALLET_METADATA)) {
493 model_type_selection |= AUTOFILL_WALLET_METADATA;
495 if (types.Has(syncer::PASSWORDS)) {
496 model_type_selection |= PASSWORD;
498 if (types.Has(syncer::PREFERENCES)) {
499 model_type_selection |= PREFERENCE;
501 if (types.Has(syncer::PRIORITY_PREFERENCES)) {
502 model_type_selection |= PRIORITY_PREFERENCE;
504 if (types.Has(syncer::TYPED_URLS)) {
505 model_type_selection |= TYPED_URL;
507 if (types.Has(syncer::SESSIONS)) {
508 model_type_selection |= SESSION;
510 if (types.Has(syncer::HISTORY_DELETE_DIRECTIVES)) {
511 model_type_selection |= HISTORY_DELETE_DIRECTIVE;
513 if (types.Has(syncer::PROXY_TABS)) {
514 model_type_selection |= PROXY_TABS;
516 if (types.Has(syncer::FAVICON_IMAGES)) {
517 model_type_selection |= FAVICON_IMAGE;
519 if (types.Has(syncer::FAVICON_TRACKING)) {
520 model_type_selection |= FAVICON_TRACKING;
522 if (types.Has(syncer::DEVICE_INFO)) {
523 model_type_selection |= DEVICE_INFO;
525 if (types.Has(syncer::NIGORI)) {
526 model_type_selection |= NIGORI;
528 if (types.Has(syncer::EXPERIMENTS)) {
529 model_type_selection |= EXPERIMENTS;
531 if (types.Has(syncer::SUPERVISED_USER_SETTINGS)) {
532 model_type_selection |= SUPERVISED_USER_SETTING;
534 if (types.Has(syncer::SUPERVISED_USER_WHITELISTS)) {
535 model_type_selection |= SUPERVISED_USER_WHITELIST;
537 return model_type_selection;
540 // static
541 std::string ProfileSyncServiceAndroid::ModelTypeSelectionToStringForTest(
542 jlong model_type_selection) {
543 ScopedJavaLocalRef<jstring> string =
544 Java_ProfileSyncService_modelTypeSelectionToStringForTest(
545 AttachCurrentThread(), model_type_selection);
546 return ConvertJavaStringToUTF8(string);
549 // static
550 ProfileSyncServiceAndroid*
551 ProfileSyncServiceAndroid::GetProfileSyncServiceAndroid() {
552 return reinterpret_cast<ProfileSyncServiceAndroid*>(
553 Java_ProfileSyncService_getProfileSyncServiceAndroid(
554 AttachCurrentThread(), base::android::GetApplicationContext()));
557 static jlong Init(JNIEnv* env, jobject obj) {
558 ProfileSyncServiceAndroid* profile_sync_service_android =
559 new ProfileSyncServiceAndroid(env, obj);
560 profile_sync_service_android->Init();
561 return reinterpret_cast<intptr_t>(profile_sync_service_android);
564 // static
565 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) {
566 return RegisterNativesImpl(env);