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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 ManagePasswordsBubbleView::PendingView::PendingView( | 164 ManagePasswordsBubbleView::PendingView::PendingView( |
165 ManagePasswordsBubbleView* parent) | 165 ManagePasswordsBubbleView* parent) |
166 : parent_(parent) { | 166 : parent_(parent) { |
167 views::GridLayout* layout = new views::GridLayout(this); | 167 views::GridLayout* layout = new views::GridLayout(this); |
168 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 168 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
169 SetLayoutManager(layout); | 169 SetLayoutManager(layout); |
170 | 170 |
171 // Create the pending credential item, save button and refusal combobox. | 171 // Create the pending credential item, save button and refusal combobox. |
172 ManagePasswordItemView* item = | 172 ManagePasswordItemView* item = |
173 new ManagePasswordItemView(parent_->model(), | 173 new ManagePasswordItemView(parent->model(), |
174 parent_->model()->pending_credentials(), | 174 parent->model()->pending_credentials(), |
175 ManagePasswordItemView::FIRST_ITEM); | 175 password_manager::ui::FIRST_ITEM); |
176 save_button_ = new views::BlueButton( | 176 save_button_ = new views::BlueButton( |
177 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); | 177 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); |
178 save_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 178 save_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
179 ui::ResourceBundle::SmallFont)); | 179 ui::ResourceBundle::SmallFont)); |
180 | 180 |
181 combobox_model_.reset(new SavePasswordRefusalComboboxModel()); | 181 combobox_model_.reset(new SavePasswordRefusalComboboxModel()); |
182 refuse_combobox_.reset(new views::Combobox(combobox_model_.get())); | 182 refuse_combobox_.reset(new views::Combobox(combobox_model_.get())); |
183 refuse_combobox_->set_listener(this); | 183 refuse_combobox_->set_listener(this); |
184 refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION); | 184 refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION); |
185 // TODO(mkwst): Need a mechanism to pipe a font list down into a combobox. | 185 // 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... |
322 // this site" message. | 322 // this site" message. |
323 if (!parent_->model()->best_matches().empty()) { | 323 if (!parent_->model()->best_matches().empty()) { |
324 for (autofill::ConstPasswordFormMap::const_iterator i( | 324 for (autofill::ConstPasswordFormMap::const_iterator i( |
325 parent_->model()->best_matches().begin()); | 325 parent_->model()->best_matches().begin()); |
326 i != parent_->model()->best_matches().end(); | 326 i != parent_->model()->best_matches().end(); |
327 ++i) { | 327 ++i) { |
328 ManagePasswordItemView* item = new ManagePasswordItemView( | 328 ManagePasswordItemView* item = new ManagePasswordItemView( |
329 parent_->model(), | 329 parent_->model(), |
330 *i->second, | 330 *i->second, |
331 i == parent_->model()->best_matches().begin() | 331 i == parent_->model()->best_matches().begin() |
332 ? ManagePasswordItemView::FIRST_ITEM | 332 ? password_manager::ui::FIRST_ITEM |
333 : ManagePasswordItemView::SUBSEQUENT_ITEM); | 333 : password_manager::ui::SUBSEQUENT_ITEM); |
334 | 334 |
335 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 335 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
336 layout->AddView(item); | 336 layout->AddView(item); |
337 } | 337 } |
338 } else { | 338 } else { |
339 views::Label* empty_label = new views::Label( | 339 views::Label* empty_label = new views::Label( |
340 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); | 340 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); |
341 empty_label->SetMultiLine(true); | 341 empty_label->SetMultiLine(true); |
342 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 342 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
343 empty_label->SetFontList( | 343 empty_label->SetFontList( |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 694 |
695 void ManagePasswordsBubbleView::StartTimerIfNecessary() { | 695 void ManagePasswordsBubbleView::StartTimerIfNecessary() { |
696 // Active bubble will stay visible until it loses focus. | 696 // Active bubble will stay visible until it loses focus. |
697 if (GetWidget()->IsActive()) | 697 if (GetWidget()->IsActive()) |
698 return; | 698 return; |
699 timer_.Start(FROM_HERE, | 699 timer_.Start(FROM_HERE, |
700 base::TimeDelta::FromSeconds(kBubbleCloseDelay), | 700 base::TimeDelta::FromSeconds(kBubbleCloseDelay), |
701 this, | 701 this, |
702 &ManagePasswordsBubbleView::Close); | 702 &ManagePasswordsBubbleView::Close); |
703 } | 703 } |
OLD | NEW |