| 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 "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 7 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
| 8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
| 9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const GURL /*url*/, const SkBitmap* bitmap) { | 114 const GURL /*url*/, const SkBitmap* bitmap) { |
| 115 if (bitmap && delegate_) | 115 if (bitmap && delegate_) |
| 116 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); | 116 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); |
| 117 | 117 |
| 118 delete this; | 118 delete this; |
| 119 } | 119 } |
| 120 | 120 |
| 121 CredentialsItemView::CredentialsItemView( | 121 CredentialsItemView::CredentialsItemView( |
| 122 views::ButtonListener* button_listener, | 122 views::ButtonListener* button_listener, |
| 123 const autofill::PasswordForm& form, | 123 const autofill::PasswordForm& form, |
| 124 password_manager::CredentialType credential_type, |
| 124 net::URLRequestContextGetter* request_context) | 125 net::URLRequestContextGetter* request_context) |
| 125 : LabelButton(button_listener, base::string16()), | 126 : LabelButton(button_listener, base::string16()), |
| 126 form_(form), | 127 form_(form), |
| 128 credential_type_(credential_type), |
| 127 weak_ptr_factory_(this) { | 129 weak_ptr_factory_(this) { |
| 128 set_notify_enter_exit_on_child(true); | 130 set_notify_enter_exit_on_child(true); |
| 129 // Create an image-view for the avatar. Make sure it ignores events so that | 131 // Create an image-view for the avatar. Make sure it ignores events so that |
| 130 // the parent can receive the events instead. | 132 // the parent can receive the events instead. |
| 131 image_view_ = new CircularImageView; | 133 image_view_ = new CircularImageView; |
| 132 image_view_->set_interactive(false); | 134 image_view_->set_interactive(false); |
| 133 gfx::Image image = | 135 gfx::Image image = |
| 134 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_26); | 136 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_26); |
| 135 image_view_->SetImageSize(gfx::Size(kIconSize, kIconSize)); | 137 image_view_->SetImageSize(gfx::Size(kIconSize, kIconSize)); |
| 136 image_view_->SetImage(image.ToImageSkia()); | 138 image_view_->SetImage(image.ToImageSkia()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 full_name_label_->SetBoundsRect(gfx::Rect(label_origin, full_name_size)); | 201 full_name_label_->SetBoundsRect(gfx::Rect(label_origin, full_name_size)); |
| 200 if (username_label_) { | 202 if (username_label_) { |
| 201 label_origin.Offset(0, full_name_size.height()); | 203 label_origin.Offset(0, full_name_size.height()); |
| 202 username_label_->SetBoundsRect(gfx::Rect(label_origin, username_size)); | 204 username_label_->SetBoundsRect(gfx::Rect(label_origin, username_size)); |
| 203 } | 205 } |
| 204 } | 206 } |
| 205 | 207 |
| 206 void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) { | 208 void CredentialsItemView::UpdateAvatar(const gfx::ImageSkia& image) { |
| 207 image_view_->SetImage(ScaleImage(image)); | 209 image_view_->SetImage(ScaleImage(image)); |
| 208 } | 210 } |
| OLD | NEW |