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

Unified Diff: chrome/browser/ui/views/passwords/credentials_item_view.cc

Issue 2532313003: Show an info icon with a tooltip for PSL-matches in the account chooser on Views. (Closed)
Patch Set: delete the icon Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/passwords/credentials_item_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/passwords/credentials_item_view.cc
diff --git a/chrome/browser/ui/views/passwords/credentials_item_view.cc b/chrome/browser/ui/views/passwords/credentials_item_view.cc
index 4227aada28c3b93706ed488330b883eb3a5fb79a..e6cf90406203128e4a23cc2cf7a25032709ad682 100644
--- a/chrome/browser/ui/views/passwords/credentials_item_view.cc
+++ b/chrome/browser/ui/views/passwords/credentials_item_view.cc
@@ -12,8 +12,11 @@
#include "components/autofill/core/common/password_form.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/path.h"
+#include "ui/gfx/vector_icons_public.h"
#include "ui/views/border.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
@@ -69,6 +72,7 @@ CredentialsItemView::CredentialsItemView(
form_(form),
upper_label_(nullptr),
lower_label_(nullptr),
+ info_icon_(nullptr),
hover_color_(hover_color),
weak_ptr_factory_(this) {
set_notify_enter_exit_on_child(true);
@@ -105,6 +109,16 @@ CredentialsItemView::CredentialsItemView(
AddChildView(lower_label_);
}
+ if (form_->is_public_suffix_match) {
+ info_icon_ = new views::ImageView;
+ info_icon_->SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::INFO_OUTLINE,
+ kInfoIconSize,
+ gfx::kChromeIconGrey));
+ info_icon_->SetTooltipText(
+ base::UTF8ToUTF16(form_->origin.GetOrigin().spec()));
+ AddChildView(info_icon_);
+ }
+
if (!upper_text.empty() && !lower_text.empty())
SetAccessibleName(upper_text + base::ASCIIToUTF16("\n") + lower_text);
else
@@ -173,6 +187,12 @@ void CredentialsItemView::Layout() {
label_origin.Offset(0, upper_size.height());
lower_label_->SetBoundsRect(gfx::Rect(label_origin, lower_size));
}
+ if (info_icon_) {
+ info_icon_->SizeToPreferredSize();
+ info_icon_->SetPosition(
+ gfx::Point(child_area.right() - info_icon_->width(),
+ child_area.CenterPoint().y() - info_icon_->height() / 2));
+ }
}
void CredentialsItemView::OnPaint(gfx::Canvas* canvas) {
« no previous file with comments | « chrome/browser/ui/views/passwords/credentials_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698