| 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" |
| 11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 const int kButtonHeight = 50; | 16 const int kButtonHeight = 50; |
| 17 } | 17 } |
| 18 | 18 |
| 19 CredentialsItemView::CredentialsItemView(views::ButtonListener* button_listener, | 19 CredentialsItemView::CredentialsItemView(views::ButtonListener* button_listener, |
| 20 const base::string16& text) | 20 const autofill::PasswordForm& form) |
| 21 : LabelButton(button_listener, text) { | 21 : LabelButton(button_listener, form.username_value), |
| 22 form_(form) { |
| 22 SetMinSize(gfx::Size(0, kButtonHeight)); | 23 SetMinSize(gfx::Size(0, kButtonHeight)); |
| 23 // TODO(vasilii): temporary code below shows the built-in profile icon instead | 24 // TODO(vasilii): temporary code below shows the built-in profile icon instead |
| 24 // of avatar. | 25 // of avatar. |
| 25 const ProfileInfoCache& cache = | 26 const ProfileInfoCache& cache = |
| 26 g_browser_process->profile_manager()->GetProfileInfoCache(); | 27 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 27 const gfx::Image& image = cache.GetAvatarIconOfProfileAtIndex(0); | 28 const gfx::Image& image = cache.GetAvatarIconOfProfileAtIndex(0); |
| 28 SetImage(STATE_NORMAL, *profiles::GetSizedAvatarIcon( | 29 SetImage(STATE_NORMAL, *profiles::GetSizedAvatarIcon( |
| 29 image, true, kButtonHeight, kButtonHeight).ToImageSkia()); | 30 image, true, kButtonHeight, kButtonHeight).ToImageSkia()); |
| 30 SetFocusable(true); | 31 SetFocusable(true); |
| 31 } | 32 } |
| 32 | 33 |
| 33 CredentialsItemView::~CredentialsItemView() { | 34 CredentialsItemView::~CredentialsItemView() { |
| 34 } | 35 } |
| OLD | NEW |