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

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;
24 import org.chromium.chrome.R; 23 import org.chromium.chrome.R;
24 import org.chromium.chrome.browser.ChromeFeatureList;
25 import org.chromium.chrome.browser.PasswordUIView; 25 import org.chromium.chrome.browser.PasswordUIView;
26 import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver; 26 import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver;
27 import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference; 27 import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference;
28 import org.chromium.chrome.browser.preferences.ChromeBasePreference; 28 import org.chromium.chrome.browser.preferences.ChromeBasePreference;
29 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; 29 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
30 import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate; 30 import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate;
31 import org.chromium.chrome.browser.preferences.PrefServiceBridge; 31 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
32 import org.chromium.chrome.browser.preferences.Preferences; 32 import org.chromium.chrome.browser.preferences.Preferences;
33 import org.chromium.chrome.browser.preferences.PreferencesLauncher; 33 import org.chromium.chrome.browser.preferences.PreferencesLauncher;
34 import org.chromium.content.common.ContentSwitches;
35 import org.chromium.ui.text.SpanApplier; 34 import org.chromium.ui.text.SpanApplier;
36 35
37 /** 36 /**
38 * The "Save passwords" screen in Settings, which allows the user to enable or d isable password 37 * 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. 38 * saving, to view saved passwords (just the username and URL), and to delete sa ved passwords.
40 */ 39 */
41 public class SavePasswordsPreferences extends PreferenceFragment 40 public class SavePasswordsPreferences extends PreferenceFragment
42 implements OnPreferenceChangeListener, PasswordListObserver, 41 implements OnPreferenceChangeListener, PasswordListObserver,
43 Preference.OnPreferenceClickListener { 42 Preference.OnPreferenceClickListener {
44 43
45 // Keys for name/password dictionaries. 44 // Keys for name/password dictionaries.
46 public static final String PASSWORD_LIST_URL = "url"; 45 public static final String PASSWORD_LIST_URL = "url";
47 public static final String PASSWORD_LIST_NAME = "name"; 46 public static final String PASSWORD_LIST_NAME = "name";
48 47
49 // Used to pass the password id into a new activity. 48 // Used to pass the password id into a new activity.
50 public static final String PASSWORD_LIST_ID = "id"; 49 public static final String PASSWORD_LIST_ID = "id";
51 50
52 public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_swit ch"; 51 public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_swit ch";
53 public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch"; 52 public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch";
54 53
54 public static final String ENABLE_CREDENTIAL_MANAGER_API = "CredentialManage mentAPI";
Bernhard Bauer 2016/04/14 13:57:48 You might have to add @VisibleForTesting to this t
55
55 private static final String PREF_CATEGORY_SAVED_PASSWORDS = "saved_passwords "; 56 private static final String PREF_CATEGORY_SAVED_PASSWORDS = "saved_passwords ";
56 private static final String PREF_CATEGORY_EXCEPTIONS = "exceptions"; 57 private static final String PREF_CATEGORY_EXCEPTIONS = "exceptions";
57 private static final String PREF_MANAGE_ACCOUNT_LINK = "manage_account_link" ; 58 private static final String PREF_MANAGE_ACCOUNT_LINK = "manage_account_link" ;
58 59
59 private static final int ORDER_SWITCH = 0; 60 private static final int ORDER_SWITCH = 0;
60 private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1; 61 private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1;
61 private static final int ORDER_MANAGE_ACCOUNT_LINK = 2; 62 private static final int ORDER_MANAGE_ACCOUNT_LINK = 2;
62 private static final int ORDER_SAVED_PASSWORDS = 3; 63 private static final int ORDER_SAVED_PASSWORDS = 3;
63 private static final int ORDER_EXCEPTIONS = 4; 64 private static final int ORDER_EXCEPTIONS = 4;
64 65
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 251
251 // Note: setting the switch state before the preference is added to the screen results in 252 // 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 253 // 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 254 // (e.g. the switch will say "On" when save passwords is really turned o ff), so
254 // .setChecked() should be called after .addPreference() 255 // .setChecked() should be called after .addPreference()
255 mSavePasswordsSwitch.setChecked( 256 mSavePasswordsSwitch.setChecked(
256 PrefServiceBridge.getInstance().isRememberPasswordsEnabled()); 257 PrefServiceBridge.getInstance().isRememberPasswordsEnabled());
257 } 258 }
258 259
259 private void createAutoSignInCheckbox() { 260 private void createAutoSignInCheckbox() {
260 if (!CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_CREDENTI AL_MANAGER_API)) { 261 if (!ChromeFeatureList.isEnabled(ENABLE_CREDENTIAL_MANAGER_API)) {
261 return; 262 return;
262 } 263 }
263 mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null ); 264 mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null );
264 mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH); 265 mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH);
265 mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title); 266 mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title);
266 mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX); 267 mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX);
267 mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description) ; 268 mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description) ;
268 mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeLi stener() { 269 mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeLi stener() {
269 @Override 270 @Override
270 public boolean onPreferenceChange(Preference preference, Object newV alue) { 271 public boolean onPreferenceChange(Preference preference, Object newV alue) {
(...skipping 24 matching lines...) Expand all
295 mLinkPref = new ChromeBasePreference(getActivity()); 296 mLinkPref = new ChromeBasePreference(getActivity());
296 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK); 297 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK);
297 mLinkPref.setTitle(title); 298 mLinkPref.setTitle(title);
298 mLinkPref.setOnPreferenceClickListener(this); 299 mLinkPref.setOnPreferenceClickListener(this);
299 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK); 300 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK);
300 } 301 }
301 getPreferenceScreen().addPreference(mLinkPref); 302 getPreferenceScreen().addPreference(mLinkPref);
302 } 303 }
303 } 304 }
304 } 305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698