Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 2888563004: Delete panel metrics and define insets in terms of distance metrics. (Closed)
Patch Set: one wrong conversion Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/user_metrics.h" 8 #include "base/metrics/user_metrics.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (model->title_brand_link_range().is_empty()) 180 if (model->title_brand_link_range().is_empty())
181 return; 181 return;
182 182
183 views::StyledLabel* title_label = 183 views::StyledLabel* title_label =
184 new views::StyledLabel(model->title(), listener); 184 new views::StyledLabel(model->title(), listener);
185 title_label->SetBaseFontList(views::style::GetFont( 185 title_label->SetBaseFontList(views::style::GetFont(
186 views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY)); 186 views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY));
187 title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle()); 187 title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle());
188 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); 188 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
189 layout->AddView(title_label); 189 layout->AddView(title_label);
190 layout->AddPaddingRow( 190 layout->AddPaddingRow(0, ChromeLayoutProvider::Get()
191 0, 191 ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS)
192 ChromeLayoutProvider::Get()->GetInsetsMetric(views::INSETS_PANEL).top()); 192 .top());
193 } 193 }
194 194
195 } // namespace 195 } // namespace
196 196
197 // ManagePasswordsBubbleView::AutoSigninView ---------------------------------- 197 // ManagePasswordsBubbleView::AutoSigninView ----------------------------------
198 198
199 // A view containing just one credential that was used for for automatic signing 199 // A view containing just one credential that was used for for automatic signing
200 // in. 200 // in.
201 class ManagePasswordsBubbleView::AutoSigninView 201 class ManagePasswordsBubbleView::AutoSigninView
202 : public views::View, 202 : public views::View,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); 335 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON));
336 336
337 // Title row. 337 // Title row.
338 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); 338 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
339 AddTitleRowWithLink(layout, parent_->model(), this); 339 AddTitleRowWithLink(layout, parent_->model(), this);
340 340
341 // Credential row. 341 // Credential row.
342 if (item) { 342 if (item) {
343 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); 343 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
344 layout->AddView(item); 344 layout->AddView(item);
345 layout->AddPaddingRow(0, ChromeLayoutProvider::Get() 345 layout->AddPaddingRow(0,
346 ->GetInsetsMetric(views::INSETS_PANEL) 346 ChromeLayoutProvider::Get()
347 .bottom()); 347 ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS)
348 .bottom());
348 } 349 }
349 350
350 // Button row. 351 // Button row.
351 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); 352 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET);
352 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); 353 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET);
353 layout->AddView(save_button_); 354 layout->AddView(save_button_);
354 layout->AddView(never_button_); 355 layout->AddView(never_button_);
355 356
356 parent_->set_initially_focused_view(save_button_); 357 parent_->set_initially_focused_view(save_button_);
357 } 358 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 manage_link_ = new views::Link(parent_->model()->manage_link()); 442 manage_link_ = new views::Link(parent_->model()->manage_link());
442 manage_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 443 manage_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
443 manage_link_->SetUnderline(false); 444 manage_link_->SetUnderline(false);
444 manage_link_->set_listener(this); 445 manage_link_->set_listener(this);
445 446
446 done_button_ = views::MdTextButton::CreateSecondaryUiButton( 447 done_button_ = views::MdTextButton::CreateSecondaryUiButton(
447 this, l10n_util::GetStringUTF16(IDS_DONE)); 448 this, l10n_util::GetStringUTF16(IDS_DONE));
448 449
449 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); 450 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
450 layout->AddPaddingRow( 451 layout->AddPaddingRow(
451 0, layout_provider->GetInsetsMetric(views::INSETS_PANEL).bottom()); 452 0,
453 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS).bottom());
452 BuildColumnSet(layout, LINK_BUTTON_COLUMN_SET); 454 BuildColumnSet(layout, LINK_BUTTON_COLUMN_SET);
453 layout->StartRowWithPadding( 455 layout->StartRowWithPadding(
454 0, LINK_BUTTON_COLUMN_SET, 0, 456 0, LINK_BUTTON_COLUMN_SET, 0,
455 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON).top()); 457 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON_ROW).top());
456 layout->AddView(manage_link_); 458 layout->AddView(manage_link_);
457 layout->AddView(done_button_); 459 layout->AddView(done_button_);
458 460
459 parent_->set_initially_focused_view(done_button_); 461 parent_->set_initially_focused_view(done_button_);
460 } 462 }
461 463
462 ManagePasswordsBubbleView::ManageView::~ManageView() { 464 ManagePasswordsBubbleView::ManageView::~ManageView() {
463 } 465 }
464 466
465 void ManagePasswordsBubbleView::ManageView::ButtonPressed( 467 void ManagePasswordsBubbleView::ManageView::ButtonPressed(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 522
521 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); 523 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
522 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); 524 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
523 layout->AddView(confirmation); 525 layout->AddView(confirmation);
524 526
525 ok_button_ = views::MdTextButton::CreateSecondaryUiButton( 527 ok_button_ = views::MdTextButton::CreateSecondaryUiButton(
526 this, l10n_util::GetStringUTF16(IDS_OK)); 528 this, l10n_util::GetStringUTF16(IDS_OK));
527 529
528 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); 530 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
529 layout->AddPaddingRow( 531 layout->AddPaddingRow(
530 0, layout_provider->GetInsetsMetric(views::INSETS_PANEL).bottom()); 532 0,
533 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS).bottom());
531 BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET); 534 BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET);
532 gfx::Insets button_insets = 535 layout->StartRowWithPadding(
533 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON); 536 0, SINGLE_BUTTON_COLUMN_SET, 0,
534 layout->StartRowWithPadding(0, SINGLE_BUTTON_COLUMN_SET, 0, 537 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON_ROW).top());
535 button_insets.top());
536 layout->AddView(ok_button_); 538 layout->AddView(ok_button_);
537 539
538 parent_->set_initially_focused_view(ok_button_); 540 parent_->set_initially_focused_view(ok_button_);
539 } 541 }
540 542
541 ManagePasswordsBubbleView::SaveConfirmationView::~SaveConfirmationView() { 543 ManagePasswordsBubbleView::SaveConfirmationView::~SaveConfirmationView() {
542 } 544 }
543 545
544 void ManagePasswordsBubbleView::SaveConfirmationView::StyledLabelLinkClicked( 546 void ManagePasswordsBubbleView::SaveConfirmationView::StyledLabelLinkClicked(
545 views::StyledLabel* label, 547 views::StyledLabel* label,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON)); 675 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON));
674 676
675 // Title row. 677 // Title row.
676 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); 678 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
677 AddTitleRowWithLink(layout, parent_->model(), this); 679 AddTitleRowWithLink(layout, parent_->model(), this);
678 680
679 // Credential row. 681 // Credential row.
680 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); 682 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
681 layout->AddView(item); 683 layout->AddView(item);
682 layout->AddPaddingRow( 684 layout->AddPaddingRow(
683 0, layout_provider->GetInsetsMetric(views::INSETS_PANEL).bottom()); 685 0,
686 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS).bottom());
684 687
685 // Button row. 688 // Button row.
686 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); 689 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET);
687 layout->StartRowWithPadding( 690 layout->StartRowWithPadding(
688 0, DOUBLE_BUTTON_COLUMN_SET, 0, 691 0, DOUBLE_BUTTON_COLUMN_SET, 0,
689 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON).top()); 692 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON_ROW).top());
690 layout->AddView(update_button_); 693 layout->AddView(update_button_);
691 layout->AddView(nope_button_); 694 layout->AddView(nope_button_);
692 695
693 parent_->set_initially_focused_view(update_button_); 696 parent_->set_initially_focused_view(update_button_);
694 } 697 }
695 698
696 ManagePasswordsBubbleView::UpdatePendingView::~UpdatePendingView() {} 699 ManagePasswordsBubbleView::UpdatePendingView::~UpdatePendingView() {}
697 700
698 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed( 701 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed(
699 views::Button* sender, 702 views::Button* sender,
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } else if (model_.state() == 896 } else if (model_.state() ==
894 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { 897 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) {
895 AddChildView(new DesktopIOSPromotionBubbleView( 898 AddChildView(new DesktopIOSPromotionBubbleView(
896 model_.GetProfile(), 899 model_.GetProfile(),
897 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); 900 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE));
898 #endif 901 #endif
899 } else { 902 } else {
900 AddChildView(new ManageView(this)); 903 AddChildView(new ManageView(this));
901 } 904 }
902 } 905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698