Chromium Code Reviews| 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/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" |
| 11 #include "chrome/browser/platform_util.h" | 11 #include "chrome/browser/platform_util.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 17 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" | 17 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" |
| 18 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" | 18 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" |
| 19 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 19 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 20 #include "chrome/browser/ui/views/harmony/chrome_typography.h" | |
| 20 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" | 21 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" |
| 21 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" | 22 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" |
| 22 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" | 23 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
| 23 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" | 24 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
| 24 #include "chrome/grit/generated_resources.h" | 25 #include "chrome/grit/generated_resources.h" |
| 25 #include "components/strings/grit/components_strings.h" | 26 #include "components/strings/grit/components_strings.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/material_design/material_design_controller.h" | 28 #include "ui/base/material_design/material_design_controller.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/base/ui_features.h" | 30 #include "ui/base/ui_features.h" |
| 30 #include "ui/gfx/color_palette.h" | 31 #include "ui/gfx/color_palette.h" |
| 31 #include "ui/gfx/image/image_skia.h" | 32 #include "ui/gfx/image/image_skia.h" |
| 32 #include "ui/native_theme/native_theme.h" | 33 #include "ui/native_theme/native_theme.h" |
| 33 #include "ui/views/controls/button/blue_button.h" | 34 #include "ui/views/controls/button/blue_button.h" |
| 34 #include "ui/views/controls/button/md_text_button.h" | 35 #include "ui/views/controls/button/md_text_button.h" |
| 35 #include "ui/views/controls/link.h" | 36 #include "ui/views/controls/link.h" |
| 36 #include "ui/views/controls/link_listener.h" | 37 #include "ui/views/controls/link_listener.h" |
| 37 #include "ui/views/controls/separator.h" | 38 #include "ui/views/controls/separator.h" |
| 38 #include "ui/views/controls/styled_label.h" | 39 #include "ui/views/controls/styled_label.h" |
| 39 #include "ui/views/controls/styled_label_listener.h" | 40 #include "ui/views/controls/styled_label_listener.h" |
| 40 #include "ui/views/layout/fill_layout.h" | 41 #include "ui/views/layout/fill_layout.h" |
| 41 #include "ui/views/layout/grid_layout.h" | 42 #include "ui/views/layout/grid_layout.h" |
| 42 #include "ui/views/layout/layout_constants.h" | |
| 43 #include "ui/views/widget/widget.h" | 43 #include "ui/views/widget/widget.h" |
| 44 | 44 |
| 45 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) | 45 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) |
| 46 #include "chrome/browser/ui/views/frame/browser_view.h" | 46 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 50 #include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bu bble_view.h" | 50 #include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bu bble_view.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 82 TRIPLE_BUTTON_COLUMN_SET, | 82 TRIPLE_BUTTON_COLUMN_SET, |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 enum TextRowType { ROW_SINGLE, ROW_MULTILINE }; | 85 enum TextRowType { ROW_SINGLE, ROW_MULTILINE }; |
| 86 | 86 |
| 87 // Construct an appropriate ColumnSet for the given |type|, and add it | 87 // Construct an appropriate ColumnSet for the given |type|, and add it |
| 88 // to |layout|. | 88 // to |layout|. |
| 89 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) { | 89 void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) { |
| 90 views::ColumnSet* column_set = layout->AddColumnSet(type); | 90 views::ColumnSet* column_set = layout->AddColumnSet(type); |
| 91 int full_width = ManagePasswordsBubbleView::kDesiredBubbleWidth; | 91 int full_width = ManagePasswordsBubbleView::kDesiredBubbleWidth; |
| 92 const int button_divider = ChromeLayoutProvider::Get()->GetDistanceMetric( | |
| 93 views::DISTANCE_RELATED_BUTTON_HORIZONTAL); | |
| 92 switch (type) { | 94 switch (type) { |
| 93 case SINGLE_VIEW_COLUMN_SET: | 95 case SINGLE_VIEW_COLUMN_SET: |
| 94 column_set->AddColumn(views::GridLayout::FILL, | 96 column_set->AddColumn(views::GridLayout::FILL, |
| 95 views::GridLayout::FILL, | 97 views::GridLayout::FILL, |
| 96 0, | 98 0, |
| 97 views::GridLayout::FIXED, | 99 views::GridLayout::FIXED, |
| 98 full_width, | 100 full_width, |
| 99 0); | 101 0); |
| 100 break; | 102 break; |
| 101 case DOUBLE_BUTTON_COLUMN_SET: | 103 case DOUBLE_BUTTON_COLUMN_SET: |
| 102 column_set->AddColumn(views::GridLayout::TRAILING, | 104 column_set->AddColumn(views::GridLayout::TRAILING, |
| 103 views::GridLayout::CENTER, | 105 views::GridLayout::CENTER, |
| 104 1, | 106 1, |
| 105 views::GridLayout::USE_PREF, | 107 views::GridLayout::USE_PREF, |
| 106 0, | 108 0, |
| 107 0); | 109 0); |
| 108 column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing); | 110 column_set->AddPaddingColumn(0, button_divider); |
| 109 column_set->AddColumn(views::GridLayout::TRAILING, | 111 column_set->AddColumn(views::GridLayout::TRAILING, |
| 110 views::GridLayout::CENTER, | 112 views::GridLayout::CENTER, |
| 111 0, | 113 0, |
| 112 views::GridLayout::USE_PREF, | 114 views::GridLayout::USE_PREF, |
| 113 0, | 115 0, |
| 114 0); | 116 0); |
| 115 break; | 117 break; |
| 116 case LINK_BUTTON_COLUMN_SET: | 118 case LINK_BUTTON_COLUMN_SET: |
| 117 column_set->AddColumn(views::GridLayout::LEADING, | 119 column_set->AddColumn(views::GridLayout::LEADING, |
| 118 views::GridLayout::CENTER, | 120 views::GridLayout::CENTER, |
| 119 1, | 121 1, |
| 120 views::GridLayout::USE_PREF, | 122 views::GridLayout::USE_PREF, |
| 121 0, | 123 0, |
| 122 0); | 124 0); |
| 123 column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing); | 125 column_set->AddPaddingColumn(0, button_divider); |
| 124 column_set->AddColumn(views::GridLayout::TRAILING, | 126 column_set->AddColumn(views::GridLayout::TRAILING, |
| 125 views::GridLayout::CENTER, | 127 views::GridLayout::CENTER, |
| 126 0, | 128 0, |
| 127 views::GridLayout::USE_PREF, | 129 views::GridLayout::USE_PREF, |
| 128 0, | 130 0, |
| 129 0); | 131 0); |
| 130 break; | 132 break; |
| 131 case SINGLE_BUTTON_COLUMN_SET: | 133 case SINGLE_BUTTON_COLUMN_SET: |
| 132 column_set->AddColumn(views::GridLayout::TRAILING, | 134 column_set->AddColumn(views::GridLayout::TRAILING, |
| 133 views::GridLayout::CENTER, | 135 views::GridLayout::CENTER, |
| 134 1, | 136 1, |
| 135 views::GridLayout::USE_PREF, | 137 views::GridLayout::USE_PREF, |
| 136 0, | 138 0, |
| 137 0); | 139 0); |
| 138 break; | 140 break; |
| 139 case TRIPLE_BUTTON_COLUMN_SET: | 141 case TRIPLE_BUTTON_COLUMN_SET: |
| 140 column_set->AddColumn(views::GridLayout::LEADING, | 142 column_set->AddColumn(views::GridLayout::LEADING, |
| 141 views::GridLayout::CENTER, | 143 views::GridLayout::CENTER, |
| 142 1, | 144 1, |
| 143 views::GridLayout::USE_PREF, | 145 views::GridLayout::USE_PREF, |
| 144 0, | 146 0, |
| 145 0); | 147 0); |
| 146 column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing); | 148 column_set->AddPaddingColumn(0, button_divider); |
| 147 column_set->AddColumn(views::GridLayout::TRAILING, | 149 column_set->AddColumn(views::GridLayout::TRAILING, |
| 148 views::GridLayout::CENTER, | 150 views::GridLayout::CENTER, |
| 149 0, | 151 0, |
| 150 views::GridLayout::USE_PREF, | 152 views::GridLayout::USE_PREF, |
| 151 0, | 153 0, |
| 152 0); | 154 0); |
| 153 column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing); | 155 column_set->AddPaddingColumn(0, button_divider); |
| 154 column_set->AddColumn(views::GridLayout::TRAILING, | 156 column_set->AddColumn(views::GridLayout::TRAILING, |
| 155 views::GridLayout::CENTER, | 157 views::GridLayout::CENTER, |
| 156 0, | 158 0, |
| 157 views::GridLayout::USE_PREF, | 159 views::GridLayout::USE_PREF, |
| 158 0, | 160 0, |
| 159 0); | 161 0); |
| 160 break; | 162 break; |
| 161 } | 163 } |
| 162 } | 164 } |
| 163 | 165 |
| 164 views::StyledLabel::RangeStyleInfo GetLinkStyle() { | 166 views::StyledLabel::RangeStyleInfo GetLinkStyle() { |
| 165 auto result = views::StyledLabel::RangeStyleInfo::CreateForLink(); | 167 auto result = views::StyledLabel::RangeStyleInfo::CreateForLink(); |
| 166 result.disable_line_wrapping = false; | 168 result.disable_line_wrapping = false; |
| 167 return result; | 169 return result; |
| 168 } | 170 } |
| 169 | 171 |
| 170 // If a special title is required (i.e. one that contains links), creates a | 172 // If a special title is required (i.e. one that contains links), creates a |
| 171 // title view and a row for it in |layout|. | 173 // title view and a row for it in |layout|. |
| 172 // TODO(estade): this should be removed and a replaced by a normal title (via | 174 // TODO(estade): this should be removed and a replaced by a normal title (via |
| 173 // GetWindowTitle). | 175 // GetWindowTitle). |
| 174 void AddTitleRowWithLink(views::GridLayout* layout, | 176 void AddTitleRowWithLink(views::GridLayout* layout, |
| 175 ManagePasswordsBubbleModel* model, | 177 ManagePasswordsBubbleModel* model, |
| 176 views::StyledLabelListener* listener) { | 178 views::StyledLabelListener* listener) { |
| 177 if (model->title_brand_link_range().is_empty()) | 179 if (model->title_brand_link_range().is_empty()) |
| 178 return; | 180 return; |
| 179 | 181 |
| 180 views::StyledLabel* title_label = | 182 views::StyledLabel* title_label = |
| 181 new views::StyledLabel(model->title(), listener); | 183 new views::StyledLabel(model->title(), listener); |
| 182 title_label->SetBaseFontList( | 184 title_label->SetBaseFontList(views::style::GetFont( |
| 183 ui::ResourceBundle::GetSharedInstance().GetFontList( | 185 views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY)); |
| 184 ui::ResourceBundle::MediumFont)); | |
| 185 title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle()); | 186 title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle()); |
| 186 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 187 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
| 187 layout->AddView(title_label); | 188 layout->AddView(title_label); |
| 188 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 189 layout->AddPaddingRow(0, ChromeLayoutProvider::Get() |
| 190 ->GetInsetsMetric(views::INSETS_BUBBLE_CONTENTS) | |
|
Peter Kasting
2017/05/15 19:51:42
Pretty sure all of these should be INSETS_PANEL to
Patti Lor
2017/05/17 07:55:27
I think all of these instances are in bubbles? It'
Peter Kasting
2017/05/17 23:53:33
I'd call that a dialog because it has buttons. Th
Patti Lor
2017/05/18 07:53:52
Ah ok, that makes sense - will keep that in mind.
| |
| 191 .top()); | |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace | 194 } // namespace |
| 192 | 195 |
| 193 // ManagePasswordsBubbleView::AutoSigninView ---------------------------------- | 196 // ManagePasswordsBubbleView::AutoSigninView ---------------------------------- |
| 194 | 197 |
| 195 // A view containing just one credential that was used for for automatic signing | 198 // A view containing just one credential that was used for for automatic signing |
| 196 // in. | 199 // in. |
| 197 class ManagePasswordsBubbleView::AutoSigninView | 200 class ManagePasswordsBubbleView::AutoSigninView |
| 198 : public views::View, | 201 : public views::View, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); | 334 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); |
| 332 | 335 |
| 333 // Title row. | 336 // Title row. |
| 334 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 337 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
| 335 AddTitleRowWithLink(layout, parent_->model(), this); | 338 AddTitleRowWithLink(layout, parent_->model(), this); |
| 336 | 339 |
| 337 // Credential row. | 340 // Credential row. |
| 338 if (item) { | 341 if (item) { |
| 339 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 342 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
| 340 layout->AddView(item); | 343 layout->AddView(item); |
| 341 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 344 layout->AddPaddingRow(0, |
| 345 ChromeLayoutProvider::Get() | |
| 346 ->GetInsetsMetric(views::INSETS_BUBBLE_CONTENTS) | |
| 347 .bottom()); | |
| 342 } | 348 } |
| 343 | 349 |
| 344 // Button row. | 350 // Button row. |
| 345 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); | 351 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
| 346 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); | 352 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); |
| 347 layout->AddView(save_button_); | 353 layout->AddView(save_button_); |
| 348 layout->AddView(never_button_); | 354 layout->AddView(never_button_); |
| 349 | 355 |
| 350 parent_->set_initially_focused_view(save_button_); | 356 parent_->set_initially_focused_view(save_button_); |
| 351 } | 357 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 | 411 |
| 406 DISALLOW_COPY_AND_ASSIGN(ManageView); | 412 DISALLOW_COPY_AND_ASSIGN(ManageView); |
| 407 }; | 413 }; |
| 408 | 414 |
| 409 ManagePasswordsBubbleView::ManageView::ManageView( | 415 ManagePasswordsBubbleView::ManageView::ManageView( |
| 410 ManagePasswordsBubbleView* parent) | 416 ManagePasswordsBubbleView* parent) |
| 411 : parent_(parent) { | 417 : parent_(parent) { |
| 412 views::GridLayout* layout = new views::GridLayout(this); | 418 views::GridLayout* layout = new views::GridLayout(this); |
| 413 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 419 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
| 414 SetLayoutManager(layout); | 420 SetLayoutManager(layout); |
| 421 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | |
| 422 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | |
| 415 | 423 |
| 416 // If we have a list of passwords to store for the current site, display | 424 // If we have a list of passwords to store for the current site, display |
| 417 // them to the user for management. Otherwise, render a "No passwords for | 425 // them to the user for management. Otherwise, render a "No passwords for |
| 418 // this site" message. | 426 // this site" message. |
| 419 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | |
| 420 if (!parent_->model()->local_credentials().empty()) { | 427 if (!parent_->model()->local_credentials().empty()) { |
| 421 ManagePasswordItemsView* item = new ManagePasswordItemsView( | 428 ManagePasswordItemsView* item = new ManagePasswordItemsView( |
| 422 parent_->model(), &parent_->model()->local_credentials()); | 429 parent_->model(), &parent_->model()->local_credentials()); |
| 423 layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, | |
| 424 views::kUnrelatedControlVerticalSpacing); | |
| 425 layout->AddView(item); | 430 layout->AddView(item); |
| 426 } else { | 431 } else { |
| 427 views::Label* empty_label = new views::Label( | 432 views::Label* empty_label = new views::Label( |
| 428 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); | 433 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS), |
| 434 CONTEXT_DEPRECATED_SMALL); | |
| 429 empty_label->SetMultiLine(true); | 435 empty_label->SetMultiLine(true); |
| 430 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 436 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 431 empty_label->SetFontList( | |
| 432 ui::ResourceBundle::GetSharedInstance().GetFontList( | |
| 433 ui::ResourceBundle::SmallFont)); | |
| 434 | |
| 435 layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, | |
| 436 views::kUnrelatedControlVerticalSpacing); | |
| 437 layout->AddView(empty_label); | 437 layout->AddView(empty_label); |
| 438 } | 438 } |
| 439 | 439 |
| 440 // Then add the "manage passwords" link and "Done" button. | 440 // Then add the "manage passwords" link and "Done" button. |
| 441 manage_link_ = new views::Link(parent_->model()->manage_link()); | 441 manage_link_ = new views::Link(parent_->model()->manage_link()); |
| 442 manage_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 442 manage_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 443 manage_link_->SetUnderline(false); | 443 manage_link_->SetUnderline(false); |
| 444 manage_link_->set_listener(this); | 444 manage_link_->set_listener(this); |
| 445 | 445 |
| 446 done_button_ = views::MdTextButton::CreateSecondaryUiButton( | 446 done_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| 447 this, l10n_util::GetStringUTF16(IDS_DONE)); | 447 this, l10n_util::GetStringUTF16(IDS_DONE)); |
| 448 | 448 |
| 449 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); | |
| 450 layout->AddPaddingRow( | |
| 451 0, | |
| 452 layout_provider->GetInsetsMetric(views::INSETS_BUBBLE_CONTENTS).bottom()); | |
| 449 BuildColumnSet(layout, LINK_BUTTON_COLUMN_SET); | 453 BuildColumnSet(layout, LINK_BUTTON_COLUMN_SET); |
| 450 layout->StartRowWithPadding(0, LINK_BUTTON_COLUMN_SET, 0, | 454 layout->StartRowWithPadding( |
| 451 views::kUnrelatedControlVerticalSpacing); | 455 0, LINK_BUTTON_COLUMN_SET, 0, |
| 456 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON).top()); | |
|
Peter Kasting
2017/05/15 19:51:42
This looks like another case where I'm wondering i
Patti Lor
2017/05/17 07:55:27
See previous comment.
| |
| 452 layout->AddView(manage_link_); | 457 layout->AddView(manage_link_); |
| 453 layout->AddView(done_button_); | 458 layout->AddView(done_button_); |
| 454 | 459 |
| 455 parent_->set_initially_focused_view(done_button_); | 460 parent_->set_initially_focused_view(done_button_); |
| 456 } | 461 } |
| 457 | 462 |
| 458 ManagePasswordsBubbleView::ManageView::~ManageView() { | 463 ManagePasswordsBubbleView::ManageView::~ManageView() { |
| 459 } | 464 } |
| 460 | 465 |
| 461 void ManagePasswordsBubbleView::ManageView::ButtonPressed( | 466 void ManagePasswordsBubbleView::ManageView::ButtonPressed( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 | 507 |
| 503 ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView( | 508 ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView( |
| 504 ManagePasswordsBubbleView* parent) | 509 ManagePasswordsBubbleView* parent) |
| 505 : parent_(parent) { | 510 : parent_(parent) { |
| 506 views::GridLayout* layout = new views::GridLayout(this); | 511 views::GridLayout* layout = new views::GridLayout(this); |
| 507 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 512 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
| 508 SetLayoutManager(layout); | 513 SetLayoutManager(layout); |
| 509 | 514 |
| 510 views::StyledLabel* confirmation = | 515 views::StyledLabel* confirmation = |
| 511 new views::StyledLabel(parent_->model()->save_confirmation_text(), this); | 516 new views::StyledLabel(parent_->model()->save_confirmation_text(), this); |
| 512 confirmation->SetBaseFontList( | 517 confirmation->SetBaseFontList(views::style::GetFont( |
| 513 ui::ResourceBundle::GetSharedInstance().GetFontList( | 518 CONTEXT_DEPRECATED_SMALL, views::style::STYLE_PRIMARY)); |
| 514 ui::ResourceBundle::SmallFont)); | 519 confirmation->AddStyleRange(parent_->model()->save_confirmation_link_range(), |
| 515 confirmation->AddStyleRange( | 520 GetLinkStyle()); |
| 516 parent_->model()->save_confirmation_link_range(), GetLinkStyle()); | |
| 517 | 521 |
| 518 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 522 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
| 519 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 523 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
| 520 layout->AddView(confirmation); | 524 layout->AddView(confirmation); |
| 521 | 525 |
| 522 ok_button_ = views::MdTextButton::CreateSecondaryUiButton( | 526 ok_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| 523 this, l10n_util::GetStringUTF16(IDS_OK)); | 527 this, l10n_util::GetStringUTF16(IDS_OK)); |
| 524 | 528 |
| 529 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); | |
| 530 layout->AddPaddingRow( | |
| 531 0, | |
| 532 layout_provider->GetInsetsMetric(views::INSETS_BUBBLE_CONTENTS).bottom()); | |
| 525 BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET); | 533 BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET); |
| 526 layout->StartRowWithPadding( | 534 gfx::Insets button_insets = |
| 527 0, SINGLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing); | 535 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON); |
| 536 layout->StartRowWithPadding(0, SINGLE_BUTTON_COLUMN_SET, 0, | |
| 537 button_insets.top()); | |
| 528 layout->AddView(ok_button_); | 538 layout->AddView(ok_button_); |
| 529 | 539 |
| 530 parent_->set_initially_focused_view(ok_button_); | 540 parent_->set_initially_focused_view(ok_button_); |
| 531 } | 541 } |
| 532 | 542 |
| 533 ManagePasswordsBubbleView::SaveConfirmationView::~SaveConfirmationView() { | 543 ManagePasswordsBubbleView::SaveConfirmationView::~SaveConfirmationView() { |
| 534 } | 544 } |
| 535 | 545 |
| 536 void ManagePasswordsBubbleView::SaveConfirmationView::StyledLabelLinkClicked( | 546 void ManagePasswordsBubbleView::SaveConfirmationView::StyledLabelLinkClicked( |
| 537 views::StyledLabel* label, | 547 views::StyledLabel* label, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 | 647 |
| 638 views::Button* update_button_; | 648 views::Button* update_button_; |
| 639 views::Button* nope_button_; | 649 views::Button* nope_button_; |
| 640 | 650 |
| 641 DISALLOW_COPY_AND_ASSIGN(UpdatePendingView); | 651 DISALLOW_COPY_AND_ASSIGN(UpdatePendingView); |
| 642 }; | 652 }; |
| 643 | 653 |
| 644 ManagePasswordsBubbleView::UpdatePendingView::UpdatePendingView( | 654 ManagePasswordsBubbleView::UpdatePendingView::UpdatePendingView( |
| 645 ManagePasswordsBubbleView* parent) | 655 ManagePasswordsBubbleView* parent) |
| 646 : parent_(parent), selection_view_(nullptr) { | 656 : parent_(parent), selection_view_(nullptr) { |
| 657 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); | |
| 647 views::GridLayout* layout = new views::GridLayout(this); | 658 views::GridLayout* layout = new views::GridLayout(this); |
| 648 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 659 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
| 649 SetLayoutManager(layout); | 660 SetLayoutManager(layout); |
| 650 | 661 |
| 651 // Create the pending credential item, update button. | 662 // Create the pending credential item, update button. |
| 652 View* item = nullptr; | 663 View* item = nullptr; |
| 653 if (parent->model()->ShouldShowMultipleAccountUpdateUI()) { | 664 if (parent->model()->ShouldShowMultipleAccountUpdateUI()) { |
| 654 selection_view_ = new CredentialsSelectionView(parent->model()); | 665 selection_view_ = new CredentialsSelectionView(parent->model()); |
| 655 item = selection_view_; | 666 item = selection_view_; |
| 656 } else { | 667 } else { |
| 657 item = new ManagePasswordItemsView(parent_->model(), | 668 item = new ManagePasswordItemsView(parent_->model(), |
| 658 &parent->model()->pending_password()); | 669 &parent->model()->pending_password()); |
| 659 } | 670 } |
| 660 nope_button_ = views::MdTextButton::CreateSecondaryUiButton( | 671 nope_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| 661 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); | 672 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); |
| 662 | 673 |
| 663 update_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( | 674 update_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( |
| 664 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON)); | 675 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON)); |
| 665 | 676 |
| 666 // Title row. | 677 // Title row. |
| 667 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 678 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
| 668 AddTitleRowWithLink(layout, parent_->model(), this); | 679 AddTitleRowWithLink(layout, parent_->model(), this); |
| 669 | 680 |
| 670 // Credential row. | 681 // Credential row. |
| 671 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 682 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
| 672 layout->AddView(item); | 683 layout->AddView(item); |
| 684 layout->AddPaddingRow( | |
| 685 0, | |
| 686 layout_provider->GetInsetsMetric(views::INSETS_BUBBLE_CONTENTS).bottom()); | |
| 673 | 687 |
| 674 // Button row. | 688 // Button row. |
| 675 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); | 689 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
| 676 layout->StartRowWithPadding(0, DOUBLE_BUTTON_COLUMN_SET, 0, | 690 layout->StartRowWithPadding( |
| 677 views::kUnrelatedControlVerticalSpacing); | 691 0, DOUBLE_BUTTON_COLUMN_SET, 0, |
| 692 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON).top()); | |
|
Peter Kasting
2017/05/15 19:51:42
And here
Patti Lor
2017/05/17 07:55:27
See previous comment.
| |
| 678 layout->AddView(update_button_); | 693 layout->AddView(update_button_); |
| 679 layout->AddView(nope_button_); | 694 layout->AddView(nope_button_); |
| 680 | 695 |
| 681 parent_->set_initially_focused_view(update_button_); | 696 parent_->set_initially_focused_view(update_button_); |
| 682 } | 697 } |
| 683 | 698 |
| 684 ManagePasswordsBubbleView::UpdatePendingView::~UpdatePendingView() {} | 699 ManagePasswordsBubbleView::UpdatePendingView::~UpdatePendingView() {} |
| 685 | 700 |
| 686 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed( | 701 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed( |
| 687 views::Button* sender, | 702 views::Button* sender, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 880 } else if (model_.state() == | 895 } else if (model_.state() == |
| 881 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 896 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
| 882 AddChildView(new DesktopIOSPromotionBubbleView( | 897 AddChildView(new DesktopIOSPromotionBubbleView( |
| 883 model_.GetProfile(), | 898 model_.GetProfile(), |
| 884 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 899 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
| 885 #endif | 900 #endif |
| 886 } else { | 901 } else { |
| 887 AddChildView(new ManageView(this)); | 902 AddChildView(new ManageView(this)); |
| 888 } | 903 } |
| 889 } | 904 } |
| OLD | NEW |