| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/manage_password_items_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 const autofill::PasswordForm& form) { | 70 const autofill::PasswordForm& form) { |
| 71 scoped_ptr<views::Label> label(new views::Label(GetDisplayUsername(form))); | 71 scoped_ptr<views::Label> label(new views::Label(GetDisplayUsername(form))); |
| 72 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 72 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 73 ui::ResourceBundle::SmallFont)); | 73 ui::ResourceBundle::SmallFont)); |
| 74 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 74 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 75 return label; | 75 return label; |
| 76 } | 76 } |
| 77 | 77 |
| 78 scoped_ptr<views::Label> GeneratePasswordLabel( | 78 scoped_ptr<views::Label> GeneratePasswordLabel( |
| 79 const autofill::PasswordForm& form) { | 79 const autofill::PasswordForm& form) { |
| 80 base::string16 text = form.federation_url.is_empty() | 80 base::string16 text = |
| 81 ? form.password_value | 81 form.federation_origin.unique() |
| 82 : l10n_util::GetStringFUTF16( | 82 ? form.password_value |
| 83 IDS_PASSWORDS_VIA_FEDERATION, | 83 : l10n_util::GetStringFUTF16( |
| 84 base::UTF8ToUTF16(form.federation_url.host())); | 84 IDS_PASSWORDS_VIA_FEDERATION, |
| 85 base::UTF8ToUTF16(form.federation_origin.host())); |
| 85 scoped_ptr<views::Label> label(new views::Label(text)); | 86 scoped_ptr<views::Label> label(new views::Label(text)); |
| 86 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 87 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 87 ui::ResourceBundle::SmallFont)); | 88 ui::ResourceBundle::SmallFont)); |
| 88 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 89 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 89 if (form.federation_url.is_empty()) | 90 if (form.federation_origin.unique()) |
| 90 label->SetObscured(true); | 91 label->SetObscured(true); |
| 91 return label; | 92 return label; |
| 92 } | 93 } |
| 93 | 94 |
| 94 scoped_ptr<views::ImageButton> GenerateDeleteButton( | 95 scoped_ptr<views::ImageButton> GenerateDeleteButton( |
| 95 views::ButtonListener* listener) { | 96 views::ButtonListener* listener) { |
| 96 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 97 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 97 scoped_ptr<views::ImageButton> button(new views::ImageButton(listener)); | 98 scoped_ptr<views::ImageButton> button(new views::ImageButton(listener)); |
| 98 button->SetImage(views::ImageButton::STATE_NORMAL, | 99 button->SetImage(views::ImageButton::STATE_NORMAL, |
| 99 rb->GetImageNamed(IDR_CLOSE_2).ToImageSkia()); | 100 rb->GetImageNamed(IDR_CLOSE_2).ToImageSkia()); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 deleted | 295 deleted |
| 295 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD | 296 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD |
| 296 : ManagePasswordsBubbleModel::ADD_PASSWORD); | 297 : ManagePasswordsBubbleModel::ADD_PASSWORD); |
| 297 } | 298 } |
| 298 | 299 |
| 299 void ManagePasswordItemsView::Refresh() { | 300 void ManagePasswordItemsView::Refresh() { |
| 300 DCHECK_NE(password_manager::ui::PENDING_PASSWORD_STATE, model_->state()); | 301 DCHECK_NE(password_manager::ui::PENDING_PASSWORD_STATE, model_->state()); |
| 301 RemoveAllChildViews(true); | 302 RemoveAllChildViews(true); |
| 302 AddRows(); | 303 AddRows(); |
| 303 } | 304 } |
| OLD | NEW |