| 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/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 9 #include "chrome/browser/profiles/profile_info_cache.h" | 9 #include "chrome/browser/profiles/profile_info_cache.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 circular_mask.addCircle( | 49 circular_mask.addCircle( |
| 50 SkIntToScalar(bounds.x() + bounds.right()) / 2, | 50 SkIntToScalar(bounds.x() + bounds.right()) / 2, |
| 51 SkIntToScalar(bounds.y() + bounds.bottom()) / 2, | 51 SkIntToScalar(bounds.y() + bounds.bottom()) / 2, |
| 52 SkIntToScalar(std::min(bounds.height(), bounds.width())) / 2); | 52 SkIntToScalar(std::min(bounds.height(), bounds.width())) / 2); |
| 53 canvas->ClipPath(circular_mask, true); | 53 canvas->ClipPath(circular_mask, true); |
| 54 ImageView::OnPaint(canvas); | 54 ImageView::OnPaint(canvas); |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 CredentialsItemView::CredentialsItemView(views::ButtonListener* button_listener, | 59 CredentialsItemView::CredentialsItemView( |
| 60 const autofill::PasswordForm& form) | 60 views::ButtonListener* button_listener, |
| 61 const autofill::PasswordForm& form, |
| 62 password_manager::CredentialType credential_type) |
| 61 : LabelButton(button_listener, base::string16()), | 63 : LabelButton(button_listener, base::string16()), |
| 62 form_(form) { | 64 form_(form), |
| 65 credential_type_(credential_type) { |
| 63 set_notify_enter_exit_on_child(true); | 66 set_notify_enter_exit_on_child(true); |
| 64 // Create an image-view for the avatar. Make sure it ignores events so that | 67 // Create an image-view for the avatar. Make sure it ignores events so that |
| 65 // the parent can receive the events instead. | 68 // the parent can receive the events instead. |
| 66 image_view_ = new CircularImageView; | 69 image_view_ = new CircularImageView; |
| 67 image_view_->set_interactive(false); | 70 image_view_->set_interactive(false); |
| 68 | 71 |
| 69 // TODO(vasilii): temporary code below shows the built-in profile icon instead | 72 // TODO(vasilii): temporary code below shows the built-in profile icon instead |
| 70 // of avatar. | 73 // of avatar. |
| 71 const ProfileInfoCache& cache = | 74 const ProfileInfoCache& cache = |
| 72 g_browser_process->profile_manager()->GetProfileInfoCache(); | 75 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 int y_offset = (child_area.height() - | 131 int y_offset = (child_area.height() - |
| 129 (full_name_size.height() + username_size.height())) / 2; | 132 (full_name_size.height() + username_size.height())) / 2; |
| 130 gfx::Point label_origin(image_origin.x() + image_size.width() + kSpacing, | 133 gfx::Point label_origin(image_origin.x() + image_size.width() + kSpacing, |
| 131 child_area.origin().y() + y_offset); | 134 child_area.origin().y() + y_offset); |
| 132 full_name_label_->SetBoundsRect(gfx::Rect(label_origin, full_name_size)); | 135 full_name_label_->SetBoundsRect(gfx::Rect(label_origin, full_name_size)); |
| 133 if (username_label_) { | 136 if (username_label_) { |
| 134 label_origin.Offset(0, full_name_size.height()); | 137 label_origin.Offset(0, full_name_size.height()); |
| 135 username_label_->SetBoundsRect(gfx::Rect(label_origin, username_size)); | 138 username_label_->SetBoundsRect(gfx::Rect(label_origin, username_size)); |
| 136 } | 139 } |
| 137 } | 140 } |
| OLD | NEW |