OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" | 5 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 AddChildView(upper_label_); | 98 AddChildView(upper_label_); |
99 } | 99 } |
100 | 100 |
101 if (!lower_text.empty()) { | 101 if (!lower_text.empty()) { |
102 lower_label_ = new views::Label( | 102 lower_label_ = new views::Label( |
103 lower_text, rb->GetFontList(ui::ResourceBundle::SmallFont)); | 103 lower_text, rb->GetFontList(ui::ResourceBundle::SmallFont)); |
104 lower_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 104 lower_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
105 AddChildView(lower_label_); | 105 AddChildView(lower_label_); |
106 } | 106 } |
107 | 107 |
108 SetFocusable(true); | 108 SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
109 } | 109 } |
110 | 110 |
111 CredentialsItemView::~CredentialsItemView() = default; | 111 CredentialsItemView::~CredentialsItemView() = default; |
112 | 112 |
113 void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) { | 113 void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) { |
114 image_view_->SetImage(ScaleImageForAccountAvatar(image)); | 114 image_view_->SetImage(ScaleImageForAccountAvatar(image)); |
115 } | 115 } |
116 | 116 |
117 void CredentialsItemView::SetLowerLabelColor(SkColor color) { | 117 void CredentialsItemView::SetLowerLabelColor(SkColor color) { |
118 if (lower_label_) | 118 if (lower_label_) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 lower_label_->SetBoundsRect(gfx::Rect(label_origin, lower_size)); | 169 lower_label_->SetBoundsRect(gfx::Rect(label_origin, lower_size)); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void CredentialsItemView::OnPaint(gfx::Canvas* canvas) { | 173 void CredentialsItemView::OnPaint(gfx::Canvas* canvas) { |
174 if (state() == STATE_PRESSED || state() == STATE_HOVERED) | 174 if (state() == STATE_PRESSED || state() == STATE_HOVERED) |
175 canvas->DrawColor(hover_color_); | 175 canvas->DrawColor(hover_color_); |
176 | 176 |
177 LabelButton::OnPaint(canvas); | 177 LabelButton::OnPaint(canvas); |
178 } | 178 } |
OLD | NEW |