| 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_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 ManagePasswordsBubbleView::PendingView::PendingView( | 161 ManagePasswordsBubbleView::PendingView::PendingView( |
| 162 ManagePasswordsBubbleView* parent) | 162 ManagePasswordsBubbleView* parent) |
| 163 : parent_(parent) { | 163 : parent_(parent) { |
| 164 views::GridLayout* layout = new views::GridLayout(this); | 164 views::GridLayout* layout = new views::GridLayout(this); |
| 165 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 165 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
| 166 SetLayoutManager(layout); | 166 SetLayoutManager(layout); |
| 167 | 167 |
| 168 // Create the pending credential item, save button and refusal combobox. | 168 // Create the pending credential item, save button and refusal combobox. |
| 169 ManagePasswordItemView* item = | 169 ManagePasswordItemView* item = |
| 170 new ManagePasswordItemView(parent_->model(), | 170 new ManagePasswordItemView(parent->model(), |
| 171 parent_->model()->pending_credentials(), | 171 parent->model()->pending_credentials(), |
| 172 ManagePasswordItemView::FIRST_ITEM); | 172 password_manager::ui::FIRST_ITEM); |
| 173 save_button_ = new views::BlueButton( | 173 save_button_ = new views::BlueButton( |
| 174 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); | 174 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); |
| 175 save_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 175 save_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 176 ui::ResourceBundle::SmallFont)); | 176 ui::ResourceBundle::SmallFont)); |
| 177 | 177 |
| 178 combobox_model_.reset(new SavePasswordRefusalComboboxModel()); | 178 combobox_model_.reset(new SavePasswordRefusalComboboxModel()); |
| 179 refuse_combobox_.reset(new views::Combobox(combobox_model_.get())); | 179 refuse_combobox_.reset(new views::Combobox(combobox_model_.get())); |
| 180 refuse_combobox_->set_listener(this); | 180 refuse_combobox_->set_listener(this); |
| 181 refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION); | 181 refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION); |
| 182 // TODO(mkwst): Need a mechanism to pipe a font list down into a combobox. | 182 // TODO(mkwst): Need a mechanism to pipe a font list down into a combobox. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // this site" message. | 319 // this site" message. |
| 320 if (!parent_->model()->best_matches().empty()) { | 320 if (!parent_->model()->best_matches().empty()) { |
| 321 for (autofill::ConstPasswordFormMap::const_iterator i( | 321 for (autofill::ConstPasswordFormMap::const_iterator i( |
| 322 parent_->model()->best_matches().begin()); | 322 parent_->model()->best_matches().begin()); |
| 323 i != parent_->model()->best_matches().end(); | 323 i != parent_->model()->best_matches().end(); |
| 324 ++i) { | 324 ++i) { |
| 325 ManagePasswordItemView* item = new ManagePasswordItemView( | 325 ManagePasswordItemView* item = new ManagePasswordItemView( |
| 326 parent_->model(), | 326 parent_->model(), |
| 327 *i->second, | 327 *i->second, |
| 328 i == parent_->model()->best_matches().begin() | 328 i == parent_->model()->best_matches().begin() |
| 329 ? ManagePasswordItemView::FIRST_ITEM | 329 ? password_manager::ui::FIRST_ITEM |
| 330 : ManagePasswordItemView::SUBSEQUENT_ITEM); | 330 : password_manager::ui::SUBSEQUENT_ITEM); |
| 331 | 331 |
| 332 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 332 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
| 333 layout->AddView(item); | 333 layout->AddView(item); |
| 334 } | 334 } |
| 335 } else { | 335 } else { |
| 336 views::Label* empty_label = new views::Label( | 336 views::Label* empty_label = new views::Label( |
| 337 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); | 337 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); |
| 338 empty_label->SetMultiLine(true); | 338 empty_label->SetMultiLine(true); |
| 339 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 339 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 340 empty_label->SetFontList( | 340 empty_label->SetFontList( |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 654 |
| 655 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { | 655 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { |
| 656 model()->OnNeverForThisSiteClicked(); | 656 model()->OnNeverForThisSiteClicked(); |
| 657 Close(); | 657 Close(); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { | 660 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { |
| 661 never_save_passwords_ = false; | 661 never_save_passwords_ = false; |
| 662 Refresh(); | 662 Refresh(); |
| 663 } | 663 } |
| OLD | NEW |