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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferences.java

Issue 1877213003: [Smart Lock, UI] Fix dissapeared Auto-signin setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 package org.chromium.chrome.browser.preferences.password; 5 package org.chromium.chrome.browser.preferences.password;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.net.Uri; 8 import android.net.Uri;
9 import android.os.Bundle; 9 import android.os.Bundle;
10 import android.preference.Preference; 10 import android.preference.Preference;
11 import android.preference.Preference.OnPreferenceChangeListener; 11 import android.preference.Preference.OnPreferenceChangeListener;
12 import android.preference.PreferenceCategory; 12 import android.preference.PreferenceCategory;
13 import android.preference.PreferenceFragment; 13 import android.preference.PreferenceFragment;
14 import android.preference.PreferenceScreen; 14 import android.preference.PreferenceScreen;
15 import android.text.SpannableString; 15 import android.text.SpannableString;
16 import android.text.style.ForegroundColorSpan; 16 import android.text.style.ForegroundColorSpan;
17 import android.view.Gravity; 17 import android.view.Gravity;
18 import android.view.View; 18 import android.view.View;
19 import android.view.ViewGroup; 19 import android.view.ViewGroup;
20 import android.widget.TextView; 20 import android.widget.TextView;
21 21
22 import org.chromium.base.ApiCompatibilityUtils; 22 import org.chromium.base.ApiCompatibilityUtils;
23 import org.chromium.base.CommandLine; 23 import org.chromium.base.VisibleForTesting;
24 import org.chromium.chrome.R; 24 import org.chromium.chrome.R;
25 import org.chromium.chrome.browser.ChromeFeatureList;
25 import org.chromium.chrome.browser.PasswordUIView; 26 import org.chromium.chrome.browser.PasswordUIView;
26 import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver; 27 import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver;
27 import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference; 28 import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference;
28 import org.chromium.chrome.browser.preferences.ChromeBasePreference; 29 import org.chromium.chrome.browser.preferences.ChromeBasePreference;
29 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; 30 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
30 import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate; 31 import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate;
31 import org.chromium.chrome.browser.preferences.PrefServiceBridge; 32 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
32 import org.chromium.chrome.browser.preferences.Preferences; 33 import org.chromium.chrome.browser.preferences.Preferences;
33 import org.chromium.chrome.browser.preferences.PreferencesLauncher; 34 import org.chromium.chrome.browser.preferences.PreferencesLauncher;
34 import org.chromium.content.common.ContentSwitches;
35 import org.chromium.ui.text.SpanApplier; 35 import org.chromium.ui.text.SpanApplier;
36 36
37 /** 37 /**
38 * The "Save passwords" screen in Settings, which allows the user to enable or d isable password 38 * The "Save passwords" screen in Settings, which allows the user to enable or d isable password
39 * saving, to view saved passwords (just the username and URL), and to delete sa ved passwords. 39 * saving, to view saved passwords (just the username and URL), and to delete sa ved passwords.
40 */ 40 */
41 public class SavePasswordsPreferences extends PreferenceFragment 41 public class SavePasswordsPreferences extends PreferenceFragment
42 implements OnPreferenceChangeListener, PasswordListObserver, 42 implements OnPreferenceChangeListener, PasswordListObserver,
43 Preference.OnPreferenceClickListener { 43 Preference.OnPreferenceClickListener {
44 44
45 // Keys for name/password dictionaries. 45 // Keys for name/password dictionaries.
46 public static final String PASSWORD_LIST_URL = "url"; 46 public static final String PASSWORD_LIST_URL = "url";
47 public static final String PASSWORD_LIST_NAME = "name"; 47 public static final String PASSWORD_LIST_NAME = "name";
48 48
49 // Used to pass the password id into a new activity. 49 // Used to pass the password id into a new activity.
50 public static final String PASSWORD_LIST_ID = "id"; 50 public static final String PASSWORD_LIST_ID = "id";
51 51
52 public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_swit ch"; 52 public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_swit ch";
53 public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch"; 53 public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch";
54 54
55 @VisibleForTesting
56 public static final String CREDENTIAL_MANAGER_API = "CredentialManagementAPI ";
57
55 private static final String PREF_CATEGORY_SAVED_PASSWORDS = "saved_passwords "; 58 private static final String PREF_CATEGORY_SAVED_PASSWORDS = "saved_passwords ";
56 private static final String PREF_CATEGORY_EXCEPTIONS = "exceptions"; 59 private static final String PREF_CATEGORY_EXCEPTIONS = "exceptions";
57 private static final String PREF_MANAGE_ACCOUNT_LINK = "manage_account_link" ; 60 private static final String PREF_MANAGE_ACCOUNT_LINK = "manage_account_link" ;
58 61
59 private static final int ORDER_SWITCH = 0; 62 private static final int ORDER_SWITCH = 0;
60 private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1; 63 private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1;
61 private static final int ORDER_MANAGE_ACCOUNT_LINK = 2; 64 private static final int ORDER_MANAGE_ACCOUNT_LINK = 2;
62 private static final int ORDER_SAVED_PASSWORDS = 3; 65 private static final int ORDER_SAVED_PASSWORDS = 3;
63 private static final int ORDER_EXCEPTIONS = 4; 66 private static final int ORDER_EXCEPTIONS = 4;
64 67
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 253
251 // Note: setting the switch state before the preference is added to the screen results in 254 // Note: setting the switch state before the preference is added to the screen results in
252 // some odd behavior where the switch state doesn't always match the int ernal enabled state 255 // some odd behavior where the switch state doesn't always match the int ernal enabled state
253 // (e.g. the switch will say "On" when save passwords is really turned o ff), so 256 // (e.g. the switch will say "On" when save passwords is really turned o ff), so
254 // .setChecked() should be called after .addPreference() 257 // .setChecked() should be called after .addPreference()
255 mSavePasswordsSwitch.setChecked( 258 mSavePasswordsSwitch.setChecked(
256 PrefServiceBridge.getInstance().isRememberPasswordsEnabled()); 259 PrefServiceBridge.getInstance().isRememberPasswordsEnabled());
257 } 260 }
258 261
259 private void createAutoSignInCheckbox() { 262 private void createAutoSignInCheckbox() {
260 if (!CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_CREDENTI AL_MANAGER_API)) { 263 if (!ChromeFeatureList.isEnabled(CREDENTIAL_MANAGER_API)) {
261 return; 264 return;
262 } 265 }
263 mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null ); 266 mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null );
264 mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH); 267 mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH);
265 mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title); 268 mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title);
266 mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX); 269 mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX);
267 mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description) ; 270 mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description) ;
268 mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeLi stener() { 271 mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeLi stener() {
269 @Override 272 @Override
270 public boolean onPreferenceChange(Preference preference, Object newV alue) { 273 public boolean onPreferenceChange(Preference preference, Object newV alue) {
(...skipping 24 matching lines...) Expand all
295 mLinkPref = new ChromeBasePreference(getActivity()); 298 mLinkPref = new ChromeBasePreference(getActivity());
296 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK); 299 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK);
297 mLinkPref.setTitle(title); 300 mLinkPref.setTitle(title);
298 mLinkPref.setOnPreferenceClickListener(this); 301 mLinkPref.setOnPreferenceClickListener(this);
299 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK); 302 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK);
300 } 303 }
301 getPreferenceScreen().addPreference(mLinkPref); 304 getPreferenceScreen().addPreference(mLinkPref);
302 } 305 }
303 } 306 }
304 } 307 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferencesTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698