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

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

Issue 2844453002: Update CM API IDL to use SecureContext (Closed)
Patch Set: Rebase Created 3 years, 7 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 17
18 import org.chromium.base.ApiCompatibilityUtils; 18 import org.chromium.base.ApiCompatibilityUtils;
19 import org.chromium.base.VisibleForTesting;
20 import org.chromium.chrome.R; 19 import org.chromium.chrome.R;
21 import org.chromium.chrome.browser.ChromeFeatureList;
22 import org.chromium.chrome.browser.PasswordUIView; 20 import org.chromium.chrome.browser.PasswordUIView;
23 import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver; 21 import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver;
24 import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference; 22 import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference;
25 import org.chromium.chrome.browser.preferences.ChromeBasePreference; 23 import org.chromium.chrome.browser.preferences.ChromeBasePreference;
26 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; 24 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
27 import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate; 25 import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate;
28 import org.chromium.chrome.browser.preferences.PrefServiceBridge; 26 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
29 import org.chromium.chrome.browser.preferences.Preferences; 27 import org.chromium.chrome.browser.preferences.Preferences;
30 import org.chromium.chrome.browser.preferences.PreferencesLauncher; 28 import org.chromium.chrome.browser.preferences.PreferencesLauncher;
31 import org.chromium.chrome.browser.preferences.TextMessagePreference; 29 import org.chromium.chrome.browser.preferences.TextMessagePreference;
(...skipping 10 matching lines...) Expand all
42 // Keys for name/password dictionaries. 40 // Keys for name/password dictionaries.
43 public static final String PASSWORD_LIST_URL = "url"; 41 public static final String PASSWORD_LIST_URL = "url";
44 public static final String PASSWORD_LIST_NAME = "name"; 42 public static final String PASSWORD_LIST_NAME = "name";
45 43
46 // Used to pass the password id into a new activity. 44 // Used to pass the password id into a new activity.
47 public static final String PASSWORD_LIST_ID = "id"; 45 public static final String PASSWORD_LIST_ID = "id";
48 46
49 public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_swit ch"; 47 public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_swit ch";
50 public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch"; 48 public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch";
51 49
52 @VisibleForTesting
53 public static final String CREDENTIAL_MANAGER_API = "CredentialManagementAPI ";
54
55 private static final String PREF_CATEGORY_SAVED_PASSWORDS = "saved_passwords "; 50 private static final String PREF_CATEGORY_SAVED_PASSWORDS = "saved_passwords ";
56 private static final String PREF_CATEGORY_EXCEPTIONS = "exceptions"; 51 private static final String PREF_CATEGORY_EXCEPTIONS = "exceptions";
57 private static final String PREF_MANAGE_ACCOUNT_LINK = "manage_account_link" ; 52 private static final String PREF_MANAGE_ACCOUNT_LINK = "manage_account_link" ;
58 private static final String PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT = "saved_p asswords_no_text"; 53 private static final String PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT = "saved_p asswords_no_text";
59 54
60 private static final int ORDER_SWITCH = 0; 55 private static final int ORDER_SWITCH = 0;
61 private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1; 56 private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1;
62 private static final int ORDER_MANAGE_ACCOUNT_LINK = 2; 57 private static final int ORDER_MANAGE_ACCOUNT_LINK = 2;
63 private static final int ORDER_SAVED_PASSWORDS = 3; 58 private static final int ORDER_SAVED_PASSWORDS = 3;
64 private static final int ORDER_EXCEPTIONS = 4; 59 private static final int ORDER_EXCEPTIONS = 4;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 235
241 // Note: setting the switch state before the preference is added to the screen results in 236 // Note: setting the switch state before the preference is added to the screen results in
242 // some odd behavior where the switch state doesn't always match the int ernal enabled state 237 // some odd behavior where the switch state doesn't always match the int ernal enabled state
243 // (e.g. the switch will say "On" when save passwords is really turned o ff), so 238 // (e.g. the switch will say "On" when save passwords is really turned o ff), so
244 // .setChecked() should be called after .addPreference() 239 // .setChecked() should be called after .addPreference()
245 mSavePasswordsSwitch.setChecked( 240 mSavePasswordsSwitch.setChecked(
246 PrefServiceBridge.getInstance().isRememberPasswordsEnabled()); 241 PrefServiceBridge.getInstance().isRememberPasswordsEnabled());
247 } 242 }
248 243
249 private void createAutoSignInCheckbox() { 244 private void createAutoSignInCheckbox() {
250 if (!ChromeFeatureList.isEnabled(CREDENTIAL_MANAGER_API)) {
251 return;
252 }
253 mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null ); 245 mAutoSignInSwitch = new ChromeBaseCheckBoxPreference(getActivity(), null );
254 mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH); 246 mAutoSignInSwitch.setKey(PREF_AUTOSIGNIN_SWITCH);
255 mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title); 247 mAutoSignInSwitch.setTitle(R.string.passwords_auto_signin_title);
256 mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX); 248 mAutoSignInSwitch.setOrder(ORDER_AUTO_SIGNIN_CHECKBOX);
257 mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description) ; 249 mAutoSignInSwitch.setSummary(R.string.passwords_auto_signin_description) ;
258 mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeLi stener() { 250 mAutoSignInSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeLi stener() {
259 @Override 251 @Override
260 public boolean onPreferenceChange(Preference preference, Object newV alue) { 252 public boolean onPreferenceChange(Preference preference, Object newV alue) {
261 PrefServiceBridge.getInstance().setPasswordManagerAutoSigninEnab led( 253 PrefServiceBridge.getInstance().setPasswordManagerAutoSigninEnab led(
262 (boolean) newValue); 254 (boolean) newValue);
(...skipping 22 matching lines...) Expand all
285 mLinkPref = new ChromeBasePreference(getActivity()); 277 mLinkPref = new ChromeBasePreference(getActivity());
286 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK); 278 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK);
287 mLinkPref.setTitle(title); 279 mLinkPref.setTitle(title);
288 mLinkPref.setOnPreferenceClickListener(this); 280 mLinkPref.setOnPreferenceClickListener(this);
289 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK); 281 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK);
290 } 282 }
291 getPreferenceScreen().addPreference(mLinkPref); 283 getPreferenceScreen().addPreference(mLinkPref);
292 } 284 }
293 } 285 }
294 } 286 }
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