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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 NOTREACHED(); | 46 NOTREACHED(); |
47 return base::string16(); | 47 return base::string16(); |
48 } | 48 } |
49 | 49 |
50 // Returns the lower text for the button. | 50 // Returns the lower text for the button. |
51 base::string16 GetLowerLabelText(const autofill::PasswordForm& form, | 51 base::string16 GetLowerLabelText(const autofill::PasswordForm& form, |
52 CredentialsItemView::Style style) { | 52 CredentialsItemView::Style style) { |
53 if (!form.federation_url.is_empty()) { | 53 if (!form.federation_url.is_empty()) { |
54 return l10n_util::GetStringFUTF16( | 54 return l10n_util::GetStringFUTF16( |
55 IDS_MANAGE_PASSWORDS_IDENTITY_PROVIDER, | 55 IDS_MANAGE_PASSWORDS_IDENTITY_PROVIDER, |
56 base::ASCIIToUTF16(form.federation_url.host())); | 56 base::UTF8ToUTF16(form.federation_url.host())); |
57 } | 57 } |
58 return form.display_name.empty() ? base::string16() : form.username_value; | 58 return form.display_name.empty() ? base::string16() : form.username_value; |
59 } | 59 } |
60 | 60 |
61 class CircularImageView : public views::ImageView { | 61 class CircularImageView : public views::ImageView { |
62 public: | 62 public: |
63 CircularImageView() = default; | 63 CircularImageView() = default; |
64 | 64 |
65 private: | 65 private: |
66 // views::ImageView: | 66 // views::ImageView: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 upper_label_->SetBoundsRect(gfx::Rect(label_origin, full_name_size)); | 171 upper_label_->SetBoundsRect(gfx::Rect(label_origin, full_name_size)); |
172 if (lower_label_) { | 172 if (lower_label_) { |
173 label_origin.Offset(0, full_name_size.height()); | 173 label_origin.Offset(0, full_name_size.height()); |
174 lower_label_->SetBoundsRect(gfx::Rect(label_origin, username_size)); | 174 lower_label_->SetBoundsRect(gfx::Rect(label_origin, username_size)); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) { | 178 void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) { |
179 image_view_->SetImage(ScaleImageForAccountAvatar(image)); | 179 image_view_->SetImage(ScaleImageForAccountAvatar(image)); |
180 } | 180 } |
OLD | NEW |