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 "base/timer/timer.h" | 7 #include "base/timer/timer.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 DISALLOW_COPY_AND_ASSIGN(PendingView); | 386 DISALLOW_COPY_AND_ASSIGN(PendingView); |
387 }; | 387 }; |
388 | 388 |
389 ManagePasswordsBubbleView::PendingView::PendingView( | 389 ManagePasswordsBubbleView::PendingView::PendingView( |
390 ManagePasswordsBubbleView* parent) | 390 ManagePasswordsBubbleView* parent) |
391 : parent_(parent) { | 391 : parent_(parent) { |
392 views::GridLayout* layout = new views::GridLayout(this); | 392 views::GridLayout* layout = new views::GridLayout(this); |
393 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 393 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
394 SetLayoutManager(layout); | 394 SetLayoutManager(layout); |
395 | 395 |
396 std::vector<const autofill::PasswordForm*> credentials( | |
397 1, &parent->model()->pending_password()); | |
398 // Create the pending credential item, save button and refusal combobox. | 396 // Create the pending credential item, save button and refusal combobox. |
399 ManagePasswordItemsView* item = | |
400 new ManagePasswordItemsView(parent_->model(), credentials); | |
401 save_button_ = new views::BlueButton( | 397 save_button_ = new views::BlueButton( |
402 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); | 398 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); |
403 save_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 399 save_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
404 ui::ResourceBundle::SmallFont)); | 400 ui::ResourceBundle::SmallFont)); |
405 | 401 |
406 combobox_model_.reset(new SavePasswordRefusalComboboxModel); | 402 combobox_model_.reset(new SavePasswordRefusalComboboxModel); |
407 refuse_combobox_.reset(new views::Combobox(combobox_model_.get())); | 403 refuse_combobox_.reset(new views::Combobox(combobox_model_.get())); |
408 refuse_combobox_->set_listener(this); | 404 refuse_combobox_->set_listener(this); |
409 refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION); | 405 refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION); |
410 // TODO(mkwst): Need a mechanism to pipe a font list down into a combobox. | 406 // TODO(mkwst): Need a mechanism to pipe a font list down into a combobox. |
411 | 407 |
412 // Title row. | 408 // Title row. |
413 views::StyledLabel* title_label = | 409 views::StyledLabel* title_label = |
414 new views::StyledLabel(parent_->model()->title(), this); | 410 new views::StyledLabel(parent_->model()->title(), this); |
415 title_label->SetBaseFontList( | 411 title_label->SetBaseFontList( |
416 ui::ResourceBundle::GetSharedInstance().GetFontList( | 412 ui::ResourceBundle::GetSharedInstance().GetFontList( |
417 ui::ResourceBundle::MediumFont)); | 413 ui::ResourceBundle::MediumFont)); |
418 if (!parent_->model()->title_brand_link_range().is_empty()) { | 414 if (!parent_->model()->title_brand_link_range().is_empty()) { |
419 title_label->AddStyleRange( | 415 title_label->AddStyleRange( |
420 parent_->model()->title_brand_link_range(), | 416 parent_->model()->title_brand_link_range(), |
421 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 417 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
422 } | 418 } |
423 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 419 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
424 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 420 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
425 layout->AddView(title_label); | 421 layout->AddView(title_label); |
426 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 422 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
427 | 423 |
428 // Credential row. | 424 // Credential row. |
429 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 425 if (!parent->model() |
vasilii
2015/08/05 16:28:26
Please no new line here.
dvadym
2015/08/05 16:51:45
Done.
| |
430 layout->AddView(item); | 426 ->pending_password() |
427 .IsPossibleChangePasswordFormWithoutUsername()) { | |
428 std::vector<const autofill::PasswordForm*> credentials( | |
429 1, &parent->model()->pending_password()); | |
430 ManagePasswordItemsView* item = | |
431 new ManagePasswordItemsView(parent_->model(), credentials); | |
vasilii
2015/08/05 16:28:26
Can you split this and initialize |item| above?
dvadym
2015/08/05 16:51:45
Done.
| |
432 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | |
433 layout->AddView(item); | |
434 } | |
431 | 435 |
432 // Button row. | 436 // Button row. |
433 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); | 437 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
434 layout->StartRowWithPadding( | 438 layout->StartRowWithPadding( |
435 0, DOUBLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing); | 439 0, DOUBLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing); |
436 layout->AddView(save_button_); | 440 layout->AddView(save_button_); |
437 layout->AddView(refuse_combobox_.get()); | 441 layout->AddView(refuse_combobox_.get()); |
438 | 442 |
439 // Extra padding for visual awesomeness. | 443 // Extra padding for visual awesomeness. |
440 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 444 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1238 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() { | 1242 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() { |
1239 if (model()->local_credentials().empty()) { | 1243 if (model()->local_credentials().empty()) { |
1240 // Skip confirmation if there are no existing passwords for this site. | 1244 // Skip confirmation if there are no existing passwords for this site. |
1241 NotifyConfirmedNeverForThisSite(); | 1245 NotifyConfirmedNeverForThisSite(); |
1242 } else { | 1246 } else { |
1243 model()->OnConfirmationForNeverForThisSite(); | 1247 model()->OnConfirmationForNeverForThisSite(); |
1244 Refresh(); | 1248 Refresh(); |
1245 SizeToContents(); | 1249 SizeToContents(); |
1246 } | 1250 } |
1247 } | 1251 } |
OLD | NEW |