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" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 } | 281 } |
| 282 | 282 |
| 283 void ManagePasswordsBubbleView::AutoSigninView::OnTimer() { | 283 void ManagePasswordsBubbleView::AutoSigninView::OnTimer() { |
| 284 parent_->model()->OnAutoSignInToastTimeout(); | 284 parent_->model()->OnAutoSignInToastTimeout(); |
| 285 parent_->CloseBubble(); | 285 parent_->CloseBubble(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 // ManagePasswordsBubbleView::PendingView ------------------------------------- | 288 // ManagePasswordsBubbleView::PendingView ------------------------------------- |
| 289 | 289 |
| 290 // A view offering the user the ability to save credentials. Contains a | 290 // A view offering the user the ability to save credentials. Contains a |
| 291 // single ManagePasswordItemsView, along with a "Save Passwords" button | 291 // single ManagePasswordItemsView, along with a "Save Passwords" button, |
| 292 // and a "Never" button. | 292 // a "Never" button and an "Edit" button to edit username field. |
| 293 class ManagePasswordsBubbleView::PendingView | 293 class ManagePasswordsBubbleView::PendingView |
| 294 : public views::View, | 294 : public views::View, |
| 295 public views::ButtonListener, | 295 public views::ButtonListener, |
| 296 public views::StyledLabelListener { | 296 public views::StyledLabelListener { |
| 297 public: | 297 public: |
| 298 explicit PendingView(ManagePasswordsBubbleView* parent); | 298 explicit PendingView(ManagePasswordsBubbleView* parent); |
| 299 ~PendingView() override; | 299 ~PendingView() override; |
| 300 | 300 |
| 301 private: | 301 private: |
| 302 // views::ButtonListener: | 302 // views::ButtonListener: |
| 303 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 303 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 304 | 304 |
| 305 // views::StyledLabelListener: | 305 // views::StyledLabelListener: |
| 306 void StyledLabelLinkClicked(views::StyledLabel* label, | 306 void StyledLabelLinkClicked(views::StyledLabel* label, |
| 307 const gfx::Range& range, | 307 const gfx::Range& range, |
| 308 int event_flags) override; | 308 int event_flags) override; |
| 309 | 309 |
| 310 ManagePasswordsBubbleView* parent_; | 310 ManagePasswordsBubbleView* parent_; |
| 311 | 311 |
| 312 views::Button* edit_button_; | |
| 312 views::Button* save_button_; | 313 views::Button* save_button_; |
| 313 views::Button* never_button_; | 314 views::Button* never_button_; |
| 314 | 315 |
| 315 DISALLOW_COPY_AND_ASSIGN(PendingView); | 316 DISALLOW_COPY_AND_ASSIGN(PendingView); |
| 316 }; | 317 }; |
| 317 | 318 |
| 318 ManagePasswordsBubbleView::PendingView::PendingView( | 319 ManagePasswordsBubbleView::PendingView::PendingView( |
| 319 ManagePasswordsBubbleView* parent) | 320 ManagePasswordsBubbleView* parent) |
| 320 : parent_(parent) { | 321 : parent_(parent) { |
| 321 views::GridLayout* layout = new views::GridLayout(this); | 322 views::GridLayout* layout = new views::GridLayout(this); |
| 322 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 323 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
| 323 SetLayoutManager(layout); | 324 SetLayoutManager(layout); |
| 324 | 325 |
| 325 // Create the pending credential item, save button and refusal combobox. | 326 // Create the pending credential item, save button and refusal combobox. |
| 326 ManagePasswordItemsView* item = nullptr; | 327 ManagePasswordItemsView* item = nullptr; |
| 327 if (!parent->model()->pending_password().username_value.empty()) { | 328 if (!parent->model()->pending_password().username_value.empty()) { |
| 328 item = new ManagePasswordItemsView(parent_->model(), | 329 item = new ManagePasswordItemsView(parent_->model(), |
| 329 &parent->model()->pending_password()); | 330 &parent->model()->pending_password()); |
| 330 } | 331 } |
| 332 edit_button_ = views::MdTextButton::CreateSecondaryUiButton( | |
| 333 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EDIT_BUTTON)); | |
| 331 save_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( | 334 save_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( |
| 332 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); | 335 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); |
| 333 never_button_ = views::MdTextButton::CreateSecondaryUiButton( | 336 never_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| 334 this, | 337 this, |
| 335 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); | 338 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); |
| 336 | 339 |
| 337 // Title row. | 340 // Title row. |
| 338 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 341 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
| 339 AddTitleRowWithLink(layout, parent_->model(), this); | 342 AddTitleRowWithLink(layout, parent_->model(), this); |
| 340 | 343 |
| 341 // Credential row. | 344 // Credential row. |
| 342 if (item) { | 345 if (item) { |
| 343 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 346 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
| 344 layout->AddView(item); | 347 layout->AddView(item); |
| 345 layout->AddPaddingRow(0, | 348 layout->AddPaddingRow(0, |
| 346 ChromeLayoutProvider::Get() | 349 ChromeLayoutProvider::Get() |
| 347 ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS) | 350 ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS) |
| 348 .bottom()); | 351 .bottom()); |
| 349 } | 352 } |
| 350 | 353 |
| 351 // Button row. | 354 // Button row. |
| 352 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); | 355 BuildColumnSet(layout, TRIPLE_BUTTON_COLUMN_SET); |
|
vasilii
2017/06/23 12:02:07
Funny that the style exists even though it was unu
irmakk
2017/06/23 12:19:56
I was surprised too, maybe they used it before and
| |
| 353 layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); | 356 layout->StartRow(0, TRIPLE_BUTTON_COLUMN_SET); |
| 357 layout->AddView(edit_button_); | |
| 354 layout->AddView(save_button_); | 358 layout->AddView(save_button_); |
| 355 layout->AddView(never_button_); | 359 layout->AddView(never_button_); |
| 356 | 360 |
| 357 parent_->set_initially_focused_view(save_button_); | 361 parent_->set_initially_focused_view(save_button_); |
| 358 } | 362 } |
| 359 | 363 |
| 360 ManagePasswordsBubbleView::PendingView::~PendingView() { | 364 ManagePasswordsBubbleView::PendingView::~PendingView() { |
| 361 } | 365 } |
| 362 | 366 |
| 363 void ManagePasswordsBubbleView::PendingView::ButtonPressed( | 367 void ManagePasswordsBubbleView::PendingView::ButtonPressed( |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 } else if (model_.state() == | 905 } else if (model_.state() == |
| 902 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 906 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
| 903 AddChildView(new DesktopIOSPromotionBubbleView( | 907 AddChildView(new DesktopIOSPromotionBubbleView( |
| 904 model_.GetProfile(), | 908 model_.GetProfile(), |
| 905 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 909 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
| 906 #endif | 910 #endif |
| 907 } else { | 911 } else { |
| 908 AddChildView(new ManageView(this)); | 912 AddChildView(new ManageView(this)); |
| 909 } | 913 } |
| 910 } | 914 } |
| OLD | NEW |