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

Side by Side Diff: chrome/browser/autofill/android/personal_data_manager_android.cc

Issue 858053003: Minor changes to still-unfinal chrome://settings/autofill wallet UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dont return void and add include Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/autofill_options.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/autofill/personal_data_manager_factory.h" 14 #include "chrome/browser/autofill/personal_data_manager_factory.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/sync/profile_sync_service.h" 18 #include "chrome/browser/sync/profile_sync_service.h"
19 #include "chrome/browser/sync/profile_sync_service_factory.h" 19 #include "chrome/browser/sync/profile_sync_service_factory.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "components/autofill/core/browser/autofill_country.h" 21 #include "components/autofill/core/browser/autofill_country.h"
22 #include "components/autofill/core/browser/autofill_type.h" 22 #include "components/autofill/core/browser/autofill_type.h"
23 #include "components/autofill/core/browser/field_types.h" 23 #include "components/autofill/core/browser/field_types.h"
24 #include "components/autofill/core/browser/personal_data_manager.h" 24 #include "components/autofill/core/browser/personal_data_manager.h"
25 #include "components/autofill/core/common/autofill_pref_names.h"
25 #include "components/autofill/core/common/autofill_switches.h" 26 #include "components/autofill/core/common/autofill_switches.h"
26 #include "jni/PersonalDataManager_jni.h" 27 #include "jni/PersonalDataManager_jni.h"
27 28
28 using base::android::ConvertJavaStringToUTF8; 29 using base::android::ConvertJavaStringToUTF8;
29 using base::android::ConvertUTF16ToJavaString; 30 using base::android::ConvertUTF16ToJavaString;
30 using base::android::ConvertUTF8ToJavaString; 31 using base::android::ConvertUTF8ToJavaString;
31 using base::android::ScopedJavaLocalRef; 32 using base::android::ScopedJavaLocalRef;
32 33
33 namespace autofill { 34 namespace autofill {
34 namespace { 35 namespace {
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 348 }
348 349
349 // TODO(estade): what to do in the IsManaged case? 350 // TODO(estade): what to do in the IsManaged case?
350 ProfileSyncService* service = 351 ProfileSyncService* service =
351 ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile()); 352 ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile());
352 return service->IsSyncEnabledAndLoggedIn(); 353 return service->IsSyncEnabledAndLoggedIn();
353 } 354 }
354 355
355 // Returns whether the Wallet import feature is enabled. 356 // Returns whether the Wallet import feature is enabled.
356 static jboolean IsWalletImportEnabled(JNIEnv* env, jclass clazz) { 357 static jboolean IsWalletImportEnabled(JNIEnv* env, jclass clazz) {
357 // TODO(estade): there is no pref yet, so just pretend yes. 358 return GetPrefs()->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled);
358 return true;
359 } 359 }
360 360
361 // Enables or disables the Wallet import feature. 361 // Enables or disables the Wallet import feature.
362 static void SetWalletImportEnabled(JNIEnv* env, jclass clazz, jboolean enable) { 362 static void SetWalletImportEnabled(JNIEnv* env, jclass clazz, jboolean enable) {
363 // TODO(estade): there is no pref yet, so no-op. 363 GetPrefs()->SetBoolean(autofill::prefs::kAutofillWalletImportEnabled, 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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/autofill_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698