Commit c79d0c2f authored by Vasilii Sukhanov's avatar Vasilii Sukhanov Committed by Commit Bot

Drop hardcoded colors from the Credential Management API UI.

Bug: 1026818
Change-Id: Ia27a49cc27a09ba8288eb013cd522a5eea26ab11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2027850Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736781}
parent 60fd8cd3
...@@ -15,15 +15,6 @@ class WebContents; ...@@ -15,15 +15,6 @@ class WebContents;
class CredentialLeakDialogController; class CredentialLeakDialogController;
class CredentialManagerDialogController; class CredentialManagerDialogController;
// The default inset from BubbleFrameView.
const int kTitleTopInset = 12;
// The color of the content in the autosign-in first run prompt.
const SkColor kAutoSigninTextColor = SkColorSetRGB(0x64, 0x64, 0x64);
// The hover color of the account chooser.
const SkColor kButtonHoverColor = SkColorSetRGB(0xEA, 0xEA, 0xEA);
// A platform-independent interface for the account chooser dialog. // A platform-independent interface for the account chooser dialog.
class AccountChooserPrompt { class AccountChooserPrompt {
public: public:
......
...@@ -53,8 +53,7 @@ views::ScrollView* CreateCredentialsView( ...@@ -53,8 +53,7 @@ views::ScrollView* CreateCredentialsView(
GetCredentialLabelsForAccountChooser(*form); GetCredentialLabelsForAccountChooser(*form);
CredentialsItemView* credential_view = CredentialsItemView* credential_view =
new CredentialsItemView(button_listener, titles.first, titles.second, new CredentialsItemView(button_listener, titles.first, titles.second,
kButtonHoverColor, form.get(), loader_factory); form.get(), loader_factory);
credential_view->SetLowerLabelColor(kAutoSigninTextColor);
ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
gfx::Insets insets = gfx::Insets insets =
layout_provider->GetInsetsMetric(views::INSETS_DIALOG_SUBSECTION); layout_provider->GetInsetsMetric(views::INSETS_DIALOG_SUBSECTION);
......
...@@ -53,12 +53,11 @@ CredentialsItemView::CredentialsItemView( ...@@ -53,12 +53,11 @@ CredentialsItemView::CredentialsItemView(
views::ButtonListener* button_listener, views::ButtonListener* button_listener,
const base::string16& upper_text, const base::string16& upper_text,
const base::string16& lower_text, const base::string16& lower_text,
SkColor hover_color,
const autofill::PasswordForm* form, const autofill::PasswordForm* form,
network::mojom::URLLoaderFactory* loader_factory, network::mojom::URLLoaderFactory* loader_factory,
int upper_text_style, int upper_text_style,
int lower_text_style) int lower_text_style)
: Button(button_listener), form_(form), hover_color_(hover_color) { : Button(button_listener), form_(form) {
set_notify_enter_exit_on_child(true); set_notify_enter_exit_on_child(true);
views::BoxLayout* layout = views::BoxLayout* layout =
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
...@@ -138,16 +137,13 @@ void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) { ...@@ -138,16 +137,13 @@ void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) {
image_view_->SetImage(ScaleImageForAccountAvatar(image)); image_view_->SetImage(ScaleImageForAccountAvatar(image));
} }
void CredentialsItemView::SetLowerLabelColor(SkColor color) {
if (lower_label_)
lower_label_->SetEnabledColor(color);
}
int CredentialsItemView::GetPreferredHeight() const { int CredentialsItemView::GetPreferredHeight() const {
return GetPreferredSize().height(); return GetPreferredSize().height();
} }
void CredentialsItemView::OnPaintBackground(gfx::Canvas* canvas) { void CredentialsItemView::OnPaintBackground(gfx::Canvas* canvas) {
if (state() == STATE_PRESSED || state() == STATE_HOVERED) if (state() == STATE_PRESSED || state() == STATE_HOVERED) {
canvas->DrawColor(hover_color_); canvas->DrawColor(GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor));
}
} }
...@@ -38,7 +38,6 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate, ...@@ -38,7 +38,6 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate,
CredentialsItemView(views::ButtonListener* button_listener, CredentialsItemView(views::ButtonListener* button_listener,
const base::string16& upper_text, const base::string16& upper_text,
const base::string16& lower_text, const base::string16& lower_text,
SkColor hover_color,
const autofill::PasswordForm* form, const autofill::PasswordForm* form,
network::mojom::URLLoaderFactory* loader_factory, network::mojom::URLLoaderFactory* loader_factory,
int upper_text_style = views::style::STYLE_PRIMARY, int upper_text_style = views::style::STYLE_PRIMARY,
...@@ -50,8 +49,6 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate, ...@@ -50,8 +49,6 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate,
// AccountAvatarFetcherDelegate: // AccountAvatarFetcherDelegate:
void UpdateAvatar(const gfx::ImageSkia& image) override; void UpdateAvatar(const gfx::ImageSkia& image) override;
void SetLowerLabelColor(SkColor color);
int GetPreferredHeight() const; int GetPreferredHeight() const;
private: private:
...@@ -65,8 +62,6 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate, ...@@ -65,8 +62,6 @@ class CredentialsItemView : public AccountAvatarFetcherDelegate,
views::Label* lower_label_ = nullptr; views::Label* lower_label_ = nullptr;
views::ImageView* info_icon_ = nullptr; views::ImageView* info_icon_ = nullptr;
SkColor hover_color_;
base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_{this}; base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(CredentialsItemView); DISALLOW_COPY_AND_ASSIGN(CredentialsItemView);
......
...@@ -46,7 +46,7 @@ PasswordAutoSignInView::PasswordAutoSignInView( ...@@ -46,7 +46,7 @@ PasswordAutoSignInView::PasswordAutoSignInView(
CredentialsItemView* credential = new CredentialsItemView( CredentialsItemView* credential = new CredentialsItemView(
this, this,
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE_MD), l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE_MD),
form.username_value, kButtonHoverColor, &form, form.username_value, &form,
content::BrowserContext::GetDefaultStoragePartition( content::BrowserContext::GetDefaultStoragePartition(
controller_.GetProfile()) controller_.GetProfile())
->GetURLLoaderFactoryForBrowserProcess() ->GetURLLoaderFactoryForBrowserProcess()
......
...@@ -272,7 +272,7 @@ PasswordPendingView::PasswordPendingView(content::WebContents* web_contents, ...@@ -272,7 +272,7 @@ PasswordPendingView::PasswordPendingView(content::WebContents* web_contents,
std::pair<base::string16, base::string16> titles = std::pair<base::string16, base::string16> titles =
GetCredentialLabelsForAccountChooser(password_form); GetCredentialLabelsForAccountChooser(password_form);
CredentialsItemView* credential_view = new CredentialsItemView( CredentialsItemView* credential_view = new CredentialsItemView(
this, titles.first, titles.second, kButtonHoverColor, &password_form, this, titles.first, titles.second, &password_form,
content::BrowserContext::GetDefaultStoragePartition( content::BrowserContext::GetDefaultStoragePartition(
model()->GetProfile()) model()->GetProfile())
->GetURLLoaderFactoryForBrowserProcess() ->GetURLLoaderFactoryForBrowserProcess()
......
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