Chromium Code Reviews| 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/autofill/android/personal_data_manager_android.h" | 5 #include "chrome/browser/autofill/android/personal_data_manager_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 } | 347 } |
| 348 | 348 |
| 349 // TODO(estade): what to do in the IsManaged case? | 349 // TODO(estade): what to do in the IsManaged case? |
| 350 ProfileSyncService* service = | 350 ProfileSyncService* service = |
| 351 ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile()); | 351 ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile()); |
| 352 return service->IsSyncEnabledAndLoggedIn(); | 352 return service->IsSyncEnabledAndLoggedIn(); |
| 353 } | 353 } |
| 354 | 354 |
| 355 // Returns whether the Wallet import feature is enabled. | 355 // Returns whether the Wallet import feature is enabled. |
| 356 static jboolean IsWalletImportEnabled(JNIEnv* env, jclass clazz) { | 356 static jboolean IsWalletImportEnabled(JNIEnv* env, jclass clazz) { |
| 357 // TODO(estade): there is no pref yet, so just pretend yes. | 357 return GetPrefs()->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled); |
| 358 return true; | |
| 359 } | 358 } |
| 360 | 359 |
| 361 // Enables or disables the Wallet import feature. | 360 // Enables or disables the Wallet import feature. |
| 362 static void SetWalletImportEnabled(JNIEnv* env, jclass clazz, jboolean enable) { | 361 static void SetWalletImportEnabled(JNIEnv* env, jclass clazz, jboolean enable) { |
| 363 // TODO(estade): there is no pref yet, so no-op. | 362 return GetPrefs()->SetBoolean(autofill::prefs::kAutofillWalletImportEnabled, |
|
please use gerrit instead
2015/01/22 01:02:53
no need for "return" here.
Evan Stade
2015/01/22 01:09:04
Done.
| |
| 363 enable); | |
| 364 } | 364 } |
| 365 | 365 |
| 366 // Returns an ISO 3166-1-alpha-2 country code for a |jcountry_name| using | 366 // Returns an ISO 3166-1-alpha-2 country code for a |jcountry_name| using |
| 367 // the application locale, or an empty string. | 367 // the application locale, or an empty string. |
| 368 static jstring ToCountryCode(JNIEnv* env, jclass clazz, jstring jcountry_name) { | 368 static jstring ToCountryCode(JNIEnv* env, jclass clazz, jstring jcountry_name) { |
| 369 return ConvertUTF8ToJavaString( | 369 return ConvertUTF8ToJavaString( |
| 370 env, | 370 env, |
| 371 AutofillCountry::GetCountryCode( | 371 AutofillCountry::GetCountryCode( |
| 372 base::android::ConvertJavaStringToUTF16(env, jcountry_name), | 372 base::android::ConvertJavaStringToUTF16(env, jcountry_name), |
| 373 g_browser_process->GetApplicationLocale())).Release(); | 373 g_browser_process->GetApplicationLocale())).Release(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 static jlong Init(JNIEnv* env, jobject obj) { | 376 static jlong Init(JNIEnv* env, jobject obj) { |
| 377 PersonalDataManagerAndroid* personal_data_manager_android = | 377 PersonalDataManagerAndroid* personal_data_manager_android = |
| 378 new PersonalDataManagerAndroid(env, obj); | 378 new PersonalDataManagerAndroid(env, obj); |
| 379 return reinterpret_cast<intptr_t>(personal_data_manager_android); | 379 return reinterpret_cast<intptr_t>(personal_data_manager_android); |
| 380 } | 380 } |
| 381 | 381 |
| 382 } // namespace autofill | 382 } // namespace autofill |
| OLD | NEW |