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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 std::unique_ptr<views::Textfield> GenerateUsernameEditable( | 120 std::unique_ptr<views::Textfield> GenerateUsernameEditable( |
121 const autofill::PasswordForm& form) { | 121 const autofill::PasswordForm& form) { |
122 auto editable = base::MakeUnique<views::Textfield>(); | 122 auto editable = base::MakeUnique<views::Textfield>(); |
123 editable->SetText(form.username_value); | 123 editable->SetText(form.username_value); |
124 return editable; | 124 return editable; |
125 } | 125 } |
126 | 126 |
127 std::unique_ptr<views::Label> GeneratePasswordLabel( | 127 std::unique_ptr<views::Label> GeneratePasswordLabel( |
128 const autofill::PasswordForm& form) { | 128 const autofill::PasswordForm& form) { |
129 base::string16 text = | 129 base::string16 text = |
130 form.federation_origin.unique() | 130 form.federation_origin.opaque() |
131 ? form.password_value | 131 ? form.password_value |
132 : l10n_util::GetStringFUTF16( | 132 : l10n_util::GetStringFUTF16( |
133 IDS_PASSWORDS_VIA_FEDERATION, | 133 IDS_PASSWORDS_VIA_FEDERATION, |
134 base::UTF8ToUTF16(form.federation_origin.host())); | 134 base::UTF8ToUTF16(form.federation_origin.host())); |
135 auto label = base::MakeUnique<views::Label>(text, CONTEXT_DEPRECATED_SMALL); | 135 auto label = base::MakeUnique<views::Label>(text, CONTEXT_DEPRECATED_SMALL); |
136 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 136 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
137 if (form.federation_origin.unique()) | 137 if (form.federation_origin.opaque()) |
138 label->SetObscured(true); | 138 label->SetObscured(true); |
139 return label; | 139 return label; |
140 } | 140 } |
141 | 141 |
142 // Manage credentials: stores credentials state and adds proper row to layout | 142 // Manage credentials: stores credentials state and adds proper row to layout |
143 // based on credential state. | 143 // based on credential state. |
144 class ManagePasswordItemsView::PasswordFormRow : public views::ButtonListener, | 144 class ManagePasswordItemsView::PasswordFormRow : public views::ButtonListener, |
145 public views::LinkListener { | 145 public views::LinkListener { |
146 public: | 146 public: |
147 PasswordFormRow(ManagePasswordItemsView* host, | 147 PasswordFormRow(ManagePasswordItemsView* host, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 model_->OnPasswordAction(password_form, | 302 model_->OnPasswordAction(password_form, |
303 deleted | 303 deleted |
304 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD | 304 ? ManagePasswordsBubbleModel::REMOVE_PASSWORD |
305 : ManagePasswordsBubbleModel::ADD_PASSWORD); | 305 : ManagePasswordsBubbleModel::ADD_PASSWORD); |
306 } | 306 } |
307 | 307 |
308 void ManagePasswordItemsView::Refresh() { | 308 void ManagePasswordItemsView::Refresh() { |
309 RemoveAllChildViews(true); | 309 RemoveAllChildViews(true); |
310 AddRows(); | 310 AddRows(); |
311 } | 311 } |
OLD | NEW |