| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 set_notify_enter_exit_on_child(true); | 98 set_notify_enter_exit_on_child(true); |
| 99 // Create an image-view for the avatar. Make sure it ignores events so that | 99 // Create an image-view for the avatar. Make sure it ignores events so that |
| 100 // the parent can receive the events instead. | 100 // the parent can receive the events instead. |
| 101 image_view_ = new CircularImageView; | 101 image_view_ = new CircularImageView; |
| 102 image_view_->set_interactive(false); | 102 image_view_->set_interactive(false); |
| 103 gfx::Image image = ResourceBundle::GetSharedInstance().GetImageNamed( | 103 gfx::Image image = ResourceBundle::GetSharedInstance().GetImageNamed( |
| 104 IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE); | 104 IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE); |
| 105 DCHECK(image.Width() >= kAvatarImageSize && | 105 DCHECK(image.Width() >= kAvatarImageSize && |
| 106 image.Height() >= kAvatarImageSize); | 106 image.Height() >= kAvatarImageSize); |
| 107 UpdateAvatar(image.AsImageSkia()); | 107 UpdateAvatar(image.AsImageSkia()); |
| 108 if (form_->avatar_url.is_valid()) { | 108 if (form_->icon_url.is_valid()) { |
| 109 // Fetch the actual avatar. | 109 // Fetch the actual avatar. |
| 110 AccountAvatarFetcher* fetcher = new AccountAvatarFetcher( | 110 AccountAvatarFetcher* fetcher = new AccountAvatarFetcher( |
| 111 form_->avatar_url, weak_ptr_factory_.GetWeakPtr()); | 111 form_->icon_url, weak_ptr_factory_.GetWeakPtr()); |
| 112 fetcher->Start(request_context); | 112 fetcher->Start(request_context); |
| 113 } | 113 } |
| 114 AddChildView(image_view_); | 114 AddChildView(image_view_); |
| 115 | 115 |
| 116 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 116 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 117 upper_label_ = new views::Label( | 117 upper_label_ = new views::Label( |
| 118 GetUpperLabelText(*form_, style), | 118 GetUpperLabelText(*form_, style), |
| 119 rb->GetFontList(ui::ResourceBundle::BoldFont)); | 119 rb->GetFontList(ui::ResourceBundle::BoldFont)); |
| 120 upper_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 120 upper_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 121 AddChildView(upper_label_); | 121 AddChildView(upper_label_); |
| (...skipping 49 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 |