Commit 0d5a0f4e authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Updated text style and context for the credentials view.

Bug: 651682
Bug: 651681
Change-Id: I571a9b503e066e58f6daa9713f85a7458c0f70e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808803
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Auto-Submit: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697357}
parent d5a43139
......@@ -62,17 +62,15 @@ CredentialsItemView::CredentialsItemView(
const base::string16& lower_text,
SkColor hover_color,
const autofill::PasswordForm* form,
network::mojom::URLLoaderFactory* loader_factory)
: Button(button_listener),
form_(form),
upper_label_(nullptr),
lower_label_(nullptr),
info_icon_(nullptr),
hover_color_(hover_color) {
network::mojom::URLLoaderFactory* loader_factory,
int upper_text_style,
int lower_text_style)
: Button(button_listener), form_(form), hover_color_(hover_color) {
set_notify_enter_exit_on_child(true);
// Create an image-view for the avatar. Make sure it ignores events so that
// the parent can receive the events instead.
image_view_ = new CircularImageView;
auto image_view = std::make_unique<CircularImageView>();
image_view_ = image_view.get();
image_view_->set_can_process_events_within_subtree(false);
gfx::Image image = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE);
......@@ -85,31 +83,30 @@ CredentialsItemView::CredentialsItemView(
form_->icon_url, weak_ptr_factory_.GetWeakPtr());
fetcher->Start(loader_factory);
}
AddChildView(image_view_);
AddChildView(std::move(image_view));
// TODO(tapted): Check these (and the STYLE_ values below) against the spec on
// http://crbug.com/651681.
const int kLabelContext = CONTEXT_BODY_TEXT_SMALL;
if (!upper_text.empty()) {
upper_label_ = new views::Label(upper_text, kLabelContext,
views::style::STYLE_PRIMARY);
upper_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(upper_label_);
auto upper_label = std::make_unique<views::Label>(upper_text, kLabelContext,
upper_text_style);
upper_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
upper_label_ = AddChildView(std::move(upper_label));
}
if (!lower_text.empty()) {
lower_label_ = new views::Label(lower_text, kLabelContext,
views::style::STYLE_SECONDARY);
lower_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
lower_label_->SetMultiLine(true);
AddChildView(lower_label_);
auto lower_label = std::make_unique<views::Label>(lower_text, kLabelContext,
lower_text_style);
lower_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
lower_label->SetMultiLine(true);
lower_label_ = AddChildView(std::move(lower_label));
}
if (form_->is_public_suffix_match) {
info_icon_ = new views::TooltipIcon(
base::UTF8ToUTF16(form_->origin.GetOrigin().spec()));
AddChildView(info_icon_);
info_icon_ = AddChildView(std::make_unique<views::TooltipIcon>(
base::UTF8ToUTF16(form_->origin.GetOrigin().spec())));
}
if (!upper_text.empty() && !lower_text.empty())
......
......@@ -9,6 +9,7 @@
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/passwords/account_avatar_fetcher.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/style/typography.h"
namespace autofill {
struct PasswordForm;
......@@ -39,7 +40,9 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate,
const base::string16& lower_text,
SkColor hover_color,
const autofill::PasswordForm* form,
network::mojom::URLLoaderFactory* loader_factory);
network::mojom::URLLoaderFactory* loader_factory,
int upper_text_style = views::style::STYLE_PRIMARY,
int lower_text_style = views::style::STYLE_SECONDARY);
~CredentialsItemView() override;
const autofill::PasswordForm* form() const { return form_; }
......@@ -62,9 +65,9 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate,
const autofill::PasswordForm* form_;
views::ImageView* image_view_;
views::Label* upper_label_;
views::Label* lower_label_;
views::ImageView* info_icon_;
views::Label* upper_label_ = nullptr;
views::Label* lower_label_ = nullptr;
views::ImageView* info_icon_ = nullptr;
SkColor hover_color_;
......
......@@ -11,6 +11,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/passwords/password_dialog_prompts.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/passwords/credentials_item_view.h"
#include "chrome/grit/generated_resources.h"
......@@ -44,7 +45,8 @@ PasswordAutoSignInView::PasswordAutoSignInView(
form.username_value, kButtonHoverColor, &form,
content::BrowserContext::GetDefaultStoragePartition(model()->GetProfile())
->GetURLLoaderFactoryForBrowserProcess()
.get());
.get(),
STYLE_HINT, views::style::STYLE_PRIMARY);
credential->SetEnabled(false);
AddChildView(credential);
......
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