| 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 #include "chrome/browser/sync/profile_sync_service_android.h" | 5 #include "chrome/browser/sync/profile_sync_service_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/field_trial.h" | |
| 16 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 19 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/signin/signin_manager_factory.h" | 20 #include "chrome/browser/signin/signin_manager_factory.h" |
| 22 #include "chrome/browser/sync/profile_sync_service.h" | 21 #include "chrome/browser/sync/profile_sync_service.h" |
| 23 #include "chrome/browser/sync/profile_sync_service_factory.h" | 22 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 24 #include "chrome/browser/sync/sync_ui_util.h" | 23 #include "chrome/browser/sync/sync_ui_util.h" |
| 25 #include "chrome/common/channel_info.h" | 24 #include "chrome/common/channel_info.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 106 |
| 108 void ProfileSyncServiceAndroid::OnStateChanged() { | 107 void ProfileSyncServiceAndroid::OnStateChanged() { |
| 109 // Notify the java world that our sync state has changed. | 108 // Notify the java world that our sync state has changed. |
| 110 JNIEnv* env = AttachCurrentThread(); | 109 JNIEnv* env = AttachCurrentThread(); |
| 111 Java_ProfileSyncService_syncStateChanged( | 110 Java_ProfileSyncService_syncStateChanged( |
| 112 env, weak_java_profile_sync_service_.get(env).obj()); | 111 env, weak_java_profile_sync_service_.get(env).obj()); |
| 113 } | 112 } |
| 114 | 113 |
| 115 jboolean ProfileSyncServiceAndroid::IsPassphrasePrompted(JNIEnv* env, | 114 jboolean ProfileSyncServiceAndroid::IsPassphrasePrompted(JNIEnv* env, |
| 116 jobject obj) { | 115 jobject obj) { |
| 117 const std::string group_name = | |
| 118 base::FieldTrialList::FindFullName("LimitSyncPassphrasePrompt"); | |
| 119 if (group_name != "Enabled") | |
| 120 return false; | |
| 121 return sync_prefs_->IsPassphrasePrompted(); | 116 return sync_prefs_->IsPassphrasePrompted(); |
| 122 } | 117 } |
| 123 | 118 |
| 124 void ProfileSyncServiceAndroid::SetPassphrasePrompted(JNIEnv* env, | 119 void ProfileSyncServiceAndroid::SetPassphrasePrompted(JNIEnv* env, |
| 125 jobject obj, | 120 jobject obj, |
| 126 jboolean prompted) { | 121 jboolean prompted) { |
| 127 sync_prefs_->SetPassphrasePrompted(prompted); | 122 sync_prefs_->SetPassphrasePrompted(prompted); |
| 128 } | 123 } |
| 129 | 124 |
| 130 void ProfileSyncServiceAndroid::RequestStart(JNIEnv* env, jobject) { | 125 void ProfileSyncServiceAndroid::RequestStart(JNIEnv* env, jobject) { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 ProfileSyncServiceAndroid* profile_sync_service_android = | 441 ProfileSyncServiceAndroid* profile_sync_service_android = |
| 447 new ProfileSyncServiceAndroid(env, obj); | 442 new ProfileSyncServiceAndroid(env, obj); |
| 448 profile_sync_service_android->Init(); | 443 profile_sync_service_android->Init(); |
| 449 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 444 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
| 450 } | 445 } |
| 451 | 446 |
| 452 // static | 447 // static |
| 453 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 448 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
| 454 return RegisterNativesImpl(env); | 449 return RegisterNativesImpl(env); |
| 455 } | 450 } |
| OLD | NEW |