Commit f7795abf authored by dozsa's avatar dozsa Committed by Commit bot

Modify PasswordEntryEditor UI to display account credentials in a user-friendly manner

This CL modifies the way in which account credentials (URL/username) are displayed on PasswordEntryEditor.java and adds buttons which will allow users to view/copy their credentials.

BUG= 628669

Review-Url: https://codereview.chromium.org/2156613002
Cr-Commit-Position: refs/heads/master@{#407158}
parent d25f5027
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
android:divider="?android:attr/dividerVertical" android:divider="?android:attr/dividerVertical"
android:dividerPadding="0dp" android:dividerPadding="0dp"
android:orientation="horizontal" android:orientation="horizontal"
android:showDividers="middle" > android:showDividers="middle"
android:visibility="gone">
<Button <Button
android:id="@+id/password_entry_editor_delete" android:id="@+id/password_entry_editor_delete"
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<LinearLayout
android:id="@+id/password_entry_editor_interactive"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:title="@string/password_entry_editor_title"
android:visibility="gone">
<TextView
android:text="@string/password_entry_editor_site_title"
android:textColor="@color/google_blue_700"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginStart="15dp"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/password_entry_editor_url"
android:textColor="@color/default_text_color"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginStart="15dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageButton
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_content_copy"
android:contentDescription="@string/password_entry_editor_copy_stored_site" />
</LinearLayout>
<TextView
android:text="@string/password_entry_editor_username_title"
android:textColor="@color/google_blue_700"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginStart="15dp"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/password_entry_editor_name"
android:textColor="@color/default_text_color"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginStart="15dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:contentDescription="@string/password_entry_editor_copy_stored_username" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageButton
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_content_copy" />
</LinearLayout>
<TextView
android:text="@string/password_entry_editor_password"
android:textColor="@color/google_blue_700"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginStart="15dp"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/password_entry_editor_password"
android:textColor="@color/default_text_color"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginStart="15dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageButton
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_visibility"
android:contentDescription="@string/password_entry_editor_view_stored_password" />
<ImageButton
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="10dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_content_copy"
android:contentDescription="@string/password_entry_editor_copy_stored_password" />
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
...@@ -13,6 +13,7 @@ import android.widget.Button; ...@@ -13,6 +13,7 @@ import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.PasswordUIView; import org.chromium.chrome.browser.PasswordUIView;
import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver; import org.chromium.chrome.browser.PasswordUIView.PasswordListObserver;
...@@ -28,6 +29,8 @@ public class PasswordEntryEditor extends Fragment { ...@@ -28,6 +29,8 @@ public class PasswordEntryEditor extends Fragment {
// If false this represents a saved name/password. // If false this represents a saved name/password.
private boolean mException; private boolean mException;
public static final String VIEW_PASSWORDS = "view-passwords";
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -37,7 +40,12 @@ public class PasswordEntryEditor extends Fragment { ...@@ -37,7 +40,12 @@ public class PasswordEntryEditor extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
View v = inflater.inflate(R.layout.password_entry_editor, container, false); View v;
if (ChromeFeatureList.isEnabled(VIEW_PASSWORDS)) {
v = inflater.inflate(R.layout.password_entry_editor_interactive, container, false);
} else {
v = inflater.inflate(R.layout.password_entry_editor, container, false);
}
getActivity().setTitle(R.string.password_entry_editor_title); getActivity().setTitle(R.string.password_entry_editor_title);
// Extras are set on this intent in class SavePasswordsPreferences. // Extras are set on this intent in class SavePasswordsPreferences.
...@@ -58,8 +66,9 @@ public class PasswordEntryEditor extends Fragment { ...@@ -58,8 +66,9 @@ public class PasswordEntryEditor extends Fragment {
String url = extras.getString(SavePasswordsPreferences.PASSWORD_LIST_URL); String url = extras.getString(SavePasswordsPreferences.PASSWORD_LIST_URL);
TextView urlView = (TextView) v.findViewById(R.id.password_entry_editor_url); TextView urlView = (TextView) v.findViewById(R.id.password_entry_editor_url);
urlView.setText(url); urlView.setText(url);
if (!ChromeFeatureList.isEnabled(VIEW_PASSWORDS)) {
hookupCancelDeleteButtons(v); hookupCancelDeleteButtons(v);
}
return v; return v;
} }
......
...@@ -337,7 +337,28 @@ CHAR-LIMIT guidelines: ...@@ -337,7 +337,28 @@ CHAR-LIMIT guidelines:
Saved passwords will appear here. Saved passwords will appear here.
</message> </message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_TITLE" desc='Title of the "edit a name/password" screen.'> <message name="IDS_PASSWORD_ENTRY_EDITOR_TITLE" desc='Title of the "edit a name/password" screen.'>
Edit saved name/password or exception Edit saved account
</message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_SITE_TITLE" desc='Title preceding the identification of the site where the stored password comes from.'>
Site
</message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_USERNAME_TITLE" desc='Title preceding username of the account where the stored password comes from.'>
Username
</message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_PASSWORD" desc='Title preceding password on password entry editor.'>
Password
</message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_COPY_STORED_SITE" desc='Content description for the button that copies the stored password.'>
Copy site
</message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_COPY_STORED_USERNAME" desc='Content description for the button that copies the stored password.'>
Copy username
</message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_COPY_STORED_PASSWORD" desc='Content description for the button that copies the stored password.'>
Copy password
</message>
<message name="IDS_PASSWORD_ENTRY_EDITOR_VIEW_STORED_PASSWORD" desc='Content description for the button that allows users to view the stored password upon reauthentication.'>
Unmask password
</message> </message>
<!-- Homepage preferences --> <!-- Homepage preferences -->
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "components/offline_pages/offline_page_feature.h" #include "components/offline_pages/offline_page_feature.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "jni/ChromeFeatureList_jni.h" #include "jni/ChromeFeatureList_jni.h"
...@@ -47,6 +48,7 @@ const base::Feature* kFeaturesExposedToJava[] = { ...@@ -47,6 +48,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&offline_pages::kOfflinePagesBackgroundLoadingFeature, &offline_pages::kOfflinePagesBackgroundLoadingFeature,
&offline_pages::kOfflinePagesCTFeature, // See crbug.com/620421. &offline_pages::kOfflinePagesCTFeature, // See crbug.com/620421.
&offline_pages::kOfflinePagesSharingFeature, &offline_pages::kOfflinePagesSharingFeature,
&password_manager::features::kViewPasswords,
}; };
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment