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

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: fix include Created 4 years, 1 month 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
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..ccd3d60b77c283931067bf25fa99a4a3a38ad9e7 100644
--- a/chrome/browser/ui/views/passwords/credentials_item_view.cc
+++ b/chrome/browser/ui/views/passwords/credentials_item_view.cc
@@ -12,9 +12,12 @@
#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/path.h"
+#include "ui/gfx/vector_icons_public.h"
#include "ui/views/border.h"
+#include "ui/views/controls/button/vector_icon_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/layout_constants.h"
@@ -69,6 +72,7 @@ CredentialsItemView::CredentialsItemView(
form_(form),
upper_label_(nullptr),
lower_label_(nullptr),
+ info_button_(nullptr),
hover_color_(hover_color),
weak_ptr_factory_(this) {
set_notify_enter_exit_on_child(true);
@@ -105,6 +109,14 @@ CredentialsItemView::CredentialsItemView(
AddChildView(lower_label_);
}
+ if (form_->is_public_suffix_match) {
+ info_button_ = new views::VectorIconButton(this);
+ info_button_->SetIcon(gfx::VectorIconId::INFORMATION);
+ info_button_->SetTooltipText(
+ base::UTF8ToUTF16(form_->origin.GetOrigin().spec()));
+ AddChildView(info_button_);
+ }
+
if (!upper_text.empty() && !lower_text.empty())
SetAccessibleName(upper_text + base::ASCIIToUTF16("\n") + lower_text);
else
@@ -173,6 +185,12 @@ void CredentialsItemView::Layout() {
label_origin.Offset(0, upper_size.height());
lower_label_->SetBoundsRect(gfx::Rect(label_origin, lower_size));
}
+ if (info_button_) {
+ gfx::Rect icon_rect(child_area.top_right(),
+ gfx::Size(kInfoIconSize, kInfoIconSize));
+ icon_rect.Offset(-kInfoIconSize, (child_area.height() - kInfoIconSize) / 2);
Evan Stade 2016/11/29 15:06:50 I had a hard time reading this (the screenshot hel
vasilii 2016/11/29 17:23:03 Done.
+ info_button_->SetBoundsRect(icon_rect);
+ }
}
void CredentialsItemView::OnPaint(gfx::Canvas* canvas) {
@@ -181,3 +199,12 @@ void CredentialsItemView::OnPaint(gfx::Canvas* canvas) {
LabelButton::OnPaint(canvas);
}
+
+void CredentialsItemView::ButtonPressed(views::Button* sender,
+ const ui::Event& event) {
+ DCHECK(sender == info_button_);
Evan Stade 2016/11/29 15:06:50 DCHECK_EQ but why is this a button if you don't c
vasilii 2016/11/29 17:23:03 Done. I'll ask the designer. I feel that many rows
vasilii 2016/11/30 13:17:45 Hwi said that the autofill dialog should switch to
+}
+
+SkColor CredentialsItemView::GetVectorIconBaseColor() const {
+ return gfx::kChromeIconGrey;
+}

Powered by Google App Engine
This is Rietveld 408576698