Commit 791ba594 authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Show icons in new PageInfo UI

Show security indicator and icons for permissions and cookies in
PageInfo.

Screenshot: https://crbug.com/1077766#c33
Bug: 1077766
Change-Id: I664ca1cf120016c24ae165d4fc0b0667a308412b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2398508Reviewed-by: default avatarEhimare Okoyomon <eokoyomon@chromium.org>
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805324}
parent 06c54845
...@@ -47,6 +47,7 @@ android_resources("java_resources") { ...@@ -47,6 +47,7 @@ android_resources("java_resources") {
"java/res/drawable-xxxhdpi/pageinfo_bad.png", "java/res/drawable-xxxhdpi/pageinfo_bad.png",
"java/res/drawable-xxxhdpi/pageinfo_good.png", "java/res/drawable-xxxhdpi/pageinfo_good.png",
"java/res/drawable-xxxhdpi/pageinfo_warning.png", "java/res/drawable-xxxhdpi/pageinfo_warning.png",
"java/res/drawable/ic_tune_24dp.xml",
"java/res/layout/connection_info.xml", "java/res/layout/connection_info.xml",
"java/res/layout/cookie_controls_view.xml", "java/res/layout/cookie_controls_view.xml",
"java/res/layout/page_info.xml", "java/res/layout/page_info.xml",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 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. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3,17v2h6v-2L3,17zM3,5v2h10L13,5L3,5zM13,21v-2h8v-2h-8v-2h-2v6h2zM7,9v2L3,11v2h4v2h2L9,9L7,9zM21,13v-2L11,11v2h10zM15,9h2L17,7h4L21,5h-4L17,3h-2v6z"
android:fillColor="@color/default_icon_color"/>
</vector>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:ignore="ContentDescription" tools:ignore="ContentDescription"
android:layout_marginEnd="10dp" android:layout_marginEnd="32dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
app:tint="@color/default_icon_color" /> app:tint="@color/default_icon_color" />
......
...@@ -8,6 +8,8 @@ import android.view.View; ...@@ -8,6 +8,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import org.chromium.components.omnibox.SecurityStatusIcon;
import org.chromium.components.security_state.SecurityStateModel;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
/** /**
...@@ -59,11 +61,16 @@ public class PageInfoConnectionController ...@@ -59,11 +61,16 @@ public class PageInfoConnectionController
} }
public void setConnectionInfo(PageInfoView.ConnectionInfoParams params) { public void setConnectionInfo(PageInfoView.ConnectionInfoParams params) {
mTitle = params.summary != null ? params.summary.toString() : null;
PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams(); PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams();
mTitle = params.summary != null ? params.summary.toString() : null;
rowParams.title = mTitle; rowParams.title = mTitle;
rowParams.subtitle = params.message != null ? params.message.toString() : null; rowParams.subtitle = params.message != null ? params.message.toString() : null;
rowParams.visible = rowParams.title != null || rowParams.subtitle != null; rowParams.visible = rowParams.title != null || rowParams.subtitle != null;
int securityLevel = SecurityStateModel.getSecurityLevelForWebContents(mWebContents);
rowParams.iconResId = SecurityStatusIcon.getSecurityIconResource(securityLevel,
SecurityStateModel.shouldShowDangerTriangleForWarningLevel(),
/*isSmallDevice=*/false,
/*skipIconForNeutralState=*/false);
if (params.clickCallback != null) rowParams.clickCallback = this::launchSubpage; if (params.clickCallback != null) rowParams.clickCallback = this::launchSubpage;
mRowView.setParams(rowParams); mRowView.setParams(rowParams);
} }
......
...@@ -48,6 +48,7 @@ public class PageInfoCookiesController ...@@ -48,6 +48,7 @@ public class PageInfoCookiesController
PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams(); PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams();
rowParams.visible = isVisible; rowParams.visible = isVisible;
rowParams.title = mTitle; rowParams.title = mTitle;
rowParams.iconResId = R.drawable.permission_cookie;
rowParams.clickCallback = this::launchSubpage; rowParams.clickCallback = this::launchSubpage;
mRowView.setParams(rowParams); mRowView.setParams(rowParams);
} }
......
...@@ -71,6 +71,7 @@ public class PageInfoPermissionsController implements PageInfoSubpageController ...@@ -71,6 +71,7 @@ public class PageInfoPermissionsController implements PageInfoSubpageController
PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams(); PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams();
rowParams.visible = true; rowParams.visible = true;
rowParams.title = mTitle; rowParams.title = mTitle;
rowParams.iconResId = R.drawable.ic_tune_24dp;
// TODO(crbug.com/1077766): Create a permissions subtitle string that represents // TODO(crbug.com/1077766): Create a permissions subtitle string that represents
// the state, using the PageInfoView.PermissionParams and potentially R.plurals. // the state, using the PageInfoView.PermissionParams and potentially R.plurals.
rowParams.clickCallback = this::launchSubpage; rowParams.clickCallback = this::launchSubpage;
......
...@@ -47,6 +47,7 @@ public class PageInfoRowView extends RelativeLayout implements OnClickListener { ...@@ -47,6 +47,7 @@ public class PageInfoRowView extends RelativeLayout implements OnClickListener {
setVisibility(params.visible ? View.VISIBLE : View.GONE); setVisibility(params.visible ? View.VISIBLE : View.GONE);
mIcon.setImageResource(params.iconResId); mIcon.setImageResource(params.iconResId);
mTitle.setText(params.title); mTitle.setText(params.title);
mTitle.setVisibility(params.title != null ? View.VISIBLE : View.GONE);
updateSubtitle(params.subtitle); updateSubtitle(params.subtitle);
mClickCallback = params.clickCallback; mClickCallback = params.clickCallback;
setOnClickListener(this); setOnClickListener(this);
......
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