Commit 79402863 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

[Passwords] Rename PasswordPending View and Controller to SaveUpdate*

Bug: 1044034
Change-Id: Id6ddb20aa0d94c218c2c9f06a41ea0305c473e02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2031404
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737325}
parent ebb83788
...@@ -1067,8 +1067,8 @@ jumbo_static_library("ui") { ...@@ -1067,8 +1067,8 @@ jumbo_static_library("ui") {
"passwords/bubble_controllers/items_bubble_controller.h", "passwords/bubble_controllers/items_bubble_controller.h",
"passwords/bubble_controllers/password_bubble_controller_base.cc", "passwords/bubble_controllers/password_bubble_controller_base.cc",
"passwords/bubble_controllers/password_bubble_controller_base.h", "passwords/bubble_controllers/password_bubble_controller_base.h",
"passwords/bubble_controllers/pending_bubble_controller.cc", "passwords/bubble_controllers/save_update_bubble_controller.cc",
"passwords/bubble_controllers/pending_bubble_controller.h", "passwords/bubble_controllers/save_update_bubble_controller.h",
"passwords/bubble_controllers/sign_in_promo_bubble_controller.cc", "passwords/bubble_controllers/sign_in_promo_bubble_controller.cc",
"passwords/bubble_controllers/sign_in_promo_bubble_controller.h", "passwords/bubble_controllers/sign_in_promo_bubble_controller.h",
"passwords/credential_leak_dialog_controller.h", "passwords/credential_leak_dialog_controller.h",
...@@ -3123,8 +3123,8 @@ jumbo_static_library("ui") { ...@@ -3123,8 +3123,8 @@ jumbo_static_library("ui") {
"views/passwords/password_generation_popup_view_views.h", "views/passwords/password_generation_popup_view_views.h",
"views/passwords/password_items_view.cc", "views/passwords/password_items_view.cc",
"views/passwords/password_items_view.h", "views/passwords/password_items_view.h",
"views/passwords/password_pending_view.cc", "views/passwords/password_save_update_view.cc",
"views/passwords/password_pending_view.h", "views/passwords/password_save_update_view.h",
"views/payments/contact_info_editor_view_controller.cc", "views/payments/contact_info_editor_view_controller.cc",
"views/payments/contact_info_editor_view_controller.h", "views/payments/contact_info_editor_view_controller.h",
"views/payments/credit_card_editor_view_controller.cc", "views/payments/credit_card_editor_view_controller.cc",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/passwords/bubble_controllers/pending_bubble_controller.h" #include "chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller.h"
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
...@@ -88,7 +88,7 @@ bool IsSyncUser(Profile* profile) { ...@@ -88,7 +88,7 @@ bool IsSyncUser(Profile* profile) {
} // namespace } // namespace
PendingBubbleController::PendingBubbleController( SaveUpdateBubbleController::SaveUpdateBubbleController(
base::WeakPtr<PasswordsModelDelegate> delegate, base::WeakPtr<PasswordsModelDelegate> delegate,
PasswordBubbleControllerBase::DisplayReason display_reason) PasswordBubbleControllerBase::DisplayReason display_reason)
: PasswordBubbleControllerBase( : PasswordBubbleControllerBase(
...@@ -151,12 +151,12 @@ PendingBubbleController::PendingBubbleController( ...@@ -151,12 +151,12 @@ PendingBubbleController::PendingBubbleController(
origin_, type, &title_); origin_, type, &title_);
} }
PendingBubbleController::~PendingBubbleController() { SaveUpdateBubbleController::~SaveUpdateBubbleController() {
if (!interaction_reported_) if (!interaction_reported_)
OnBubbleClosing(); OnBubbleClosing();
} }
void PendingBubbleController::OnSaveClicked() { void SaveUpdateBubbleController::OnSaveClicked() {
DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_STATE || DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_STATE ||
state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE); state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
dismissal_reason_ = metrics_util::CLICKED_SAVE; dismissal_reason_ = metrics_util::CLICKED_SAVE;
...@@ -167,14 +167,14 @@ void PendingBubbleController::OnSaveClicked() { ...@@ -167,14 +167,14 @@ void PendingBubbleController::OnSaveClicked() {
} }
} }
void PendingBubbleController::OnNopeUpdateClicked() { void SaveUpdateBubbleController::OnNopeUpdateClicked() {
DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, state_); DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, state_);
dismissal_reason_ = metrics_util::CLICKED_CANCEL; dismissal_reason_ = metrics_util::CLICKED_CANCEL;
if (delegate_) if (delegate_)
delegate_->OnNopeUpdateClicked(); delegate_->OnNopeUpdateClicked();
} }
void PendingBubbleController::OnNeverForThisSiteClicked() { void SaveUpdateBubbleController::OnNeverForThisSiteClicked() {
DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_); DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_);
dismissal_reason_ = metrics_util::CLICKED_NEVER; dismissal_reason_ = metrics_util::CLICKED_NEVER;
if (delegate_) { if (delegate_) {
...@@ -183,7 +183,8 @@ void PendingBubbleController::OnNeverForThisSiteClicked() { ...@@ -183,7 +183,8 @@ void PendingBubbleController::OnNeverForThisSiteClicked() {
} }
} }
void PendingBubbleController::OnCredentialEdited(base::string16 new_username, void SaveUpdateBubbleController::OnCredentialEdited(
base::string16 new_username,
base::string16 new_password) { base::string16 new_password) {
DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_STATE || DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_STATE ||
state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE); state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
...@@ -191,7 +192,7 @@ void PendingBubbleController::OnCredentialEdited(base::string16 new_username, ...@@ -191,7 +192,7 @@ void PendingBubbleController::OnCredentialEdited(base::string16 new_username,
pending_password_.password_value = std::move(new_password); pending_password_.password_value = std::move(new_password);
} }
bool PendingBubbleController::IsCurrentStateUpdate() const { bool SaveUpdateBubbleController::IsCurrentStateUpdate() const {
DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
state_ == password_manager::ui::PENDING_PASSWORD_STATE); state_ == password_manager::ui::PENDING_PASSWORD_STATE);
return std::any_of(local_credentials_.begin(), local_credentials_.end(), return std::any_of(local_credentials_.begin(), local_credentials_.end(),
...@@ -201,13 +202,13 @@ bool PendingBubbleController::IsCurrentStateUpdate() const { ...@@ -201,13 +202,13 @@ bool PendingBubbleController::IsCurrentStateUpdate() const {
}); });
} }
bool PendingBubbleController::ShouldShowFooter() const { bool SaveUpdateBubbleController::ShouldShowFooter() const {
return (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || return (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
state_ == password_manager::ui::PENDING_PASSWORD_STATE) && state_ == password_manager::ui::PENDING_PASSWORD_STATE) &&
IsSyncUser(GetProfile()); IsSyncUser(GetProfile());
} }
int PendingBubbleController::GetTopIllustration(bool dark_mode) const { int SaveUpdateBubbleController::GetTopIllustration(bool dark_mode) const {
if (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || if (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
state_ == password_manager::ui::PENDING_PASSWORD_STATE) { state_ == password_manager::ui::PENDING_PASSWORD_STATE) {
int image = base::GetFieldTrialParamByFeatureAsInt( int image = base::GetFieldTrialParamByFeatureAsInt(
...@@ -226,7 +227,7 @@ int PendingBubbleController::GetTopIllustration(bool dark_mode) const { ...@@ -226,7 +227,7 @@ int PendingBubbleController::GetTopIllustration(bool dark_mode) const {
return 0; return 0;
} }
bool PendingBubbleController::ReplaceToShowPromotionIfNeeded() { bool SaveUpdateBubbleController::ReplaceToShowPromotionIfNeeded() {
Profile* profile = GetProfile(); Profile* profile = GetProfile();
if (!profile) if (!profile)
return false; return false;
...@@ -249,7 +250,7 @@ bool PendingBubbleController::ReplaceToShowPromotionIfNeeded() { ...@@ -249,7 +250,7 @@ bool PendingBubbleController::ReplaceToShowPromotionIfNeeded() {
return false; return false;
} }
bool PendingBubbleController::RevealPasswords() { bool SaveUpdateBubbleController::RevealPasswords() {
bool reveal_immediately = !password_revealing_requires_reauth_ || bool reveal_immediately = !password_revealing_requires_reauth_ ||
(delegate_ && delegate_->AuthenticateUser()); (delegate_ && delegate_->AuthenticateUser());
if (reveal_immediately) if (reveal_immediately)
...@@ -258,18 +259,18 @@ bool PendingBubbleController::RevealPasswords() { ...@@ -258,18 +259,18 @@ bool PendingBubbleController::RevealPasswords() {
} }
#if defined(PASSWORD_STORE_SELECT_ENABLED) #if defined(PASSWORD_STORE_SELECT_ENABLED)
void PendingBubbleController::OnToggleAccountStore(bool is_checked) { void SaveUpdateBubbleController::OnToggleAccountStore(bool is_checked) {
delegate_->GetPasswordFeatureManager()->SetDefaultPasswordStore( delegate_->GetPasswordFeatureManager()->SetDefaultPasswordStore(
is_checked ? Store::kAccountStore : Store::kProfileStore); is_checked ? Store::kAccountStore : Store::kProfileStore);
} }
bool PendingBubbleController::IsUsingAccountStore() { bool SaveUpdateBubbleController::IsUsingAccountStore() {
return delegate_->GetPasswordFeatureManager()->GetDefaultPasswordStore() == return delegate_->GetPasswordFeatureManager()->GetDefaultPasswordStore() ==
Store::kAccountStore; Store::kAccountStore;
} }
#endif // defined(PASSWORD_STORE_SELECT_ENABLED) #endif // defined(PASSWORD_STORE_SELECT_ENABLED)
void PendingBubbleController::ReportInteractions() { void SaveUpdateBubbleController::ReportInteractions() {
if (state_ == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) if (state_ == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE)
return; return;
DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
...@@ -315,6 +316,6 @@ void PendingBubbleController::ReportInteractions() { ...@@ -315,6 +316,6 @@ void PendingBubbleController::ReportInteractions() {
metrics_recorder_->RecordUIDismissalReason(dismissal_reason_); metrics_recorder_->RecordUIDismissalReason(dismissal_reason_);
} }
base::string16 PendingBubbleController::GetTitle() const { base::string16 SaveUpdateBubbleController::GetTitle() const {
return title_; return title_;
} }
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_PENDING_BUBBLE_CONTROLLER_H_ #ifndef CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_SAVE_UPDATE_BUBBLE_CONTROLLER_H_
#define CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_PENDING_BUBBLE_CONTROLLER_H_ #define CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_SAVE_UPDATE_BUBBLE_CONTROLLER_H_
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/passwords/bubble_controllers/password_bubble_controller_base.h" #include "chrome/browser/ui/passwords/bubble_controllers/password_bubble_controller_base.h"
...@@ -16,13 +16,13 @@ namespace base { ...@@ -16,13 +16,13 @@ namespace base {
class Clock; class Clock;
} }
// This controller provides data and actions for the PasswordPendingView. // This controller provides data and actions for the PasswordSaveUpdateView.
class PendingBubbleController : public PasswordBubbleControllerBase { class SaveUpdateBubbleController : public PasswordBubbleControllerBase {
public: public:
explicit PendingBubbleController( explicit SaveUpdateBubbleController(
base::WeakPtr<PasswordsModelDelegate> delegate, base::WeakPtr<PasswordsModelDelegate> delegate,
DisplayReason display_reason); DisplayReason display_reason);
~PendingBubbleController() override; ~SaveUpdateBubbleController() override;
// Called by the view code when the save/update button is clicked by the user. // Called by the view code when the save/update button is clicked by the user.
void OnSaveClicked(); void OnSaveClicked();
...@@ -126,4 +126,4 @@ class PendingBubbleController : public PasswordBubbleControllerBase { ...@@ -126,4 +126,4 @@ class PendingBubbleController : public PasswordBubbleControllerBase {
base::Clock* clock_; base::Clock* clock_;
}; };
#endif // CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_PENDING_BUBBLE_CONTROLLER_H_ #endif // CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_SAVE_UPDATE_BUBBLE_CONTROLLER_H_
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h"
#include "chrome/browser/ui/views/passwords/password_auto_sign_in_view.h" #include "chrome/browser/ui/views/passwords/password_auto_sign_in_view.h"
#include "chrome/browser/ui/views/passwords/password_pending_view.h" #include "chrome/browser/ui/views/passwords/password_save_update_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
...@@ -82,7 +82,8 @@ IN_PROC_BROWSER_TEST_F(PasswordBubbleInteractiveUiTest, BasicOpenAndClose) { ...@@ -82,7 +82,8 @@ IN_PROC_BROWSER_TEST_F(PasswordBubbleInteractiveUiTest, BasicOpenAndClose) {
EXPECT_FALSE(IsBubbleShowing()); EXPECT_FALSE(IsBubbleShowing());
SetupPendingPassword(); SetupPendingPassword();
EXPECT_TRUE(IsBubbleShowing()); EXPECT_TRUE(IsBubbleShowing());
const PasswordPendingView* bubble = static_cast<const PasswordPendingView*>( const PasswordSaveUpdateView* bubble =
static_cast<const PasswordSaveUpdateView*>(
PasswordBubbleViewBase::manage_password_bubble()); PasswordBubbleViewBase::manage_password_bubble());
EXPECT_FALSE(bubble->GetFocusManager()->GetFocusedView()); EXPECT_FALSE(bubble->GetFocusManager()->GetFocusedView());
PasswordBubbleViewBase::CloseCurrentBubble(); PasswordBubbleViewBase::CloseCurrentBubble();
...@@ -97,7 +98,7 @@ IN_PROC_BROWSER_TEST_F(PasswordBubbleInteractiveUiTest, BasicOpenAndClose) { ...@@ -97,7 +98,7 @@ IN_PROC_BROWSER_TEST_F(PasswordBubbleInteractiveUiTest, BasicOpenAndClose) {
browser()->tab_strip_model()->GetActiveWebContents()) browser()->tab_strip_model()->GetActiveWebContents())
->ShowManagePasswordsBubble(true /* user_action */); ->ShowManagePasswordsBubble(true /* user_action */);
EXPECT_TRUE(IsBubbleShowing()); EXPECT_TRUE(IsBubbleShowing());
bubble = static_cast<const PasswordPendingView*>( bubble = static_cast<const PasswordSaveUpdateView*>(
PasswordBubbleViewBase::manage_password_bubble()); PasswordBubbleViewBase::manage_password_bubble());
// A pending password with empty username should initially focus on the // A pending password with empty username should initially focus on the
// username field. // username field.
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "chrome/browser/ui/views/passwords/password_auto_sign_in_view.h" #include "chrome/browser/ui/views/passwords/password_auto_sign_in_view.h"
#include "chrome/browser/ui/views/passwords/password_generation_confirmation_view.h" #include "chrome/browser/ui/views/passwords/password_generation_confirmation_view.h"
#include "chrome/browser/ui/views/passwords/password_items_view.h" #include "chrome/browser/ui/views/passwords/password_items_view.h"
#include "chrome/browser/ui/views/passwords/password_pending_view.h" #include "chrome/browser/ui/views/passwords/password_save_update_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "components/autofill/core/common/autofill_payments_features.h" #include "components/autofill/core/common/autofill_payments_features.h"
#include "components/password_manager/core/common/password_manager_features.h" #include "components/password_manager/core/common/password_manager_features.h"
...@@ -71,7 +71,7 @@ PasswordBubbleViewBase* PasswordBubbleViewBase::CreateBubble( ...@@ -71,7 +71,7 @@ PasswordBubbleViewBase* PasswordBubbleViewBase::CreateBubble(
} else if (model_state == } else if (model_state ==
password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
model_state == password_manager::ui::PENDING_PASSWORD_STATE) { model_state == password_manager::ui::PENDING_PASSWORD_STATE) {
view = new PasswordPendingView(web_contents, anchor_view, reason); view = new PasswordSaveUpdateView(web_contents, anchor_view, reason);
} else { } else {
NOTREACHED(); NOTREACHED();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/passwords/password_pending_view.h" #include "chrome/browser/ui/views/passwords/password_save_update_view.h"
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
namespace { namespace {
enum PasswordPendingViewColumnSetType { enum PasswordSaveUpdateViewColumnSetType {
// | | (LEADING, FILL) | | (FILL, FILL) | | // | | (LEADING, FILL) | | (FILL, FILL) | |
// Used for the username/password line of the bubble, for the pending view. // Used for the username/password line of the bubble, for the pending view.
DOUBLE_VIEW_COLUMN_SET_USERNAME, DOUBLE_VIEW_COLUMN_SET_USERNAME,
...@@ -64,7 +64,7 @@ enum PasswordPendingViewColumnSetType { ...@@ -64,7 +64,7 @@ enum PasswordPendingViewColumnSetType {
// Construct an appropriate ColumnSet for the given |type|, and add it // Construct an appropriate ColumnSet for the given |type|, and add it
// to |layout|. // to |layout|.
void BuildColumnSet(views::GridLayout* layout, void BuildColumnSet(views::GridLayout* layout,
PasswordPendingViewColumnSetType type) { PasswordSaveUpdateViewColumnSetType type) {
views::ColumnSet* column_set = layout->AddColumnSet(type); views::ColumnSet* column_set = layout->AddColumnSet(type);
const int column_divider = ChromeLayoutProvider::Get()->GetDistanceMetric( const int column_divider = ChromeLayoutProvider::Get()->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_HORIZONTAL); views::DISTANCE_RELATED_CONTROL_HORIZONTAL);
...@@ -132,8 +132,8 @@ void BuildCredentialRows( ...@@ -132,8 +132,8 @@ void BuildCredentialRows(
DISTANCE_CONTROL_LIST_VERTICAL)); DISTANCE_CONTROL_LIST_VERTICAL));
// Password row. // Password row.
PasswordPendingViewColumnSetType type = password_view_button PasswordSaveUpdateViewColumnSetType type =
? TRIPLE_VIEW_COLUMN_SET password_view_button ? TRIPLE_VIEW_COLUMN_SET
: DOUBLE_VIEW_COLUMN_SET_PASSWORD; : DOUBLE_VIEW_COLUMN_SET_PASSWORD;
BuildColumnSet(layout, type); BuildColumnSet(layout, type);
layout->StartRow(views::GridLayout::kFixedSize, type); layout->StartRow(views::GridLayout::kFixedSize, type);
...@@ -247,7 +247,8 @@ views::Checkbox* MaybeAppendAccountCheckboxRow( ...@@ -247,7 +247,8 @@ views::Checkbox* MaybeAppendAccountCheckboxRow(
} // namespace } // namespace
PasswordPendingView::PasswordPendingView(content::WebContents* web_contents, PasswordSaveUpdateView::PasswordSaveUpdateView(
content::WebContents* web_contents,
views::View* anchor_view, views::View* anchor_view,
DisplayReason reason) DisplayReason reason)
: PasswordBubbleViewBase(web_contents, : PasswordBubbleViewBase(web_contents,
...@@ -316,21 +317,22 @@ PasswordPendingView::PasswordPendingView(content::WebContents* web_contents, ...@@ -316,21 +317,22 @@ PasswordPendingView::PasswordPendingView(content::WebContents* web_contents,
UpdateDialogButtons(); UpdateDialogButtons();
} }
views::View* PasswordPendingView::GetUsernameTextfieldForTest() const { views::View* PasswordSaveUpdateView::GetUsernameTextfieldForTest() const {
return username_dropdown_->GetTextfieldForTest(); return username_dropdown_->GetTextfieldForTest();
} }
PasswordPendingView::~PasswordPendingView() = default; PasswordSaveUpdateView::~PasswordSaveUpdateView() = default;
PasswordBubbleControllerBase* PasswordPendingView::GetController() { PasswordBubbleControllerBase* PasswordSaveUpdateView::GetController() {
return &controller_; return &controller_;
} }
const PasswordBubbleControllerBase* PasswordPendingView::GetController() const { const PasswordBubbleControllerBase* PasswordSaveUpdateView::GetController()
const {
return &controller_; return &controller_;
} }
bool PasswordPendingView::Accept() { bool PasswordSaveUpdateView::Accept() {
UpdateUsernameAndPasswordInModel(); UpdateUsernameAndPasswordInModel();
controller_.OnSaveClicked(); controller_.OnSaveClicked();
if (controller_.ReplaceToShowPromotionIfNeeded()) { if (controller_.ReplaceToShowPromotionIfNeeded()) {
...@@ -340,7 +342,7 @@ bool PasswordPendingView::Accept() { ...@@ -340,7 +342,7 @@ bool PasswordPendingView::Accept() {
return true; return true;
} }
bool PasswordPendingView::Cancel() { bool PasswordSaveUpdateView::Cancel() {
UpdateUsernameAndPasswordInModel(); UpdateUsernameAndPasswordInModel();
if (is_update_bubble_) { if (is_update_bubble_) {
controller_.OnNopeUpdateClicked(); controller_.OnNopeUpdateClicked();
...@@ -350,11 +352,11 @@ bool PasswordPendingView::Cancel() { ...@@ -350,11 +352,11 @@ bool PasswordPendingView::Cancel() {
return true; return true;
} }
bool PasswordPendingView::Close() { bool PasswordSaveUpdateView::Close() {
return true; return true;
} }
void PasswordPendingView::ButtonPressed(views::Button* sender, void PasswordSaveUpdateView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
#if defined(PASSWORD_STORE_SELECT_ENABLED) #if defined(PASSWORD_STORE_SELECT_ENABLED)
DCHECK(sender); DCHECK(sender);
...@@ -367,7 +369,7 @@ void PasswordPendingView::ButtonPressed(views::Button* sender, ...@@ -367,7 +369,7 @@ void PasswordPendingView::ButtonPressed(views::Button* sender,
TogglePasswordVisibility(); TogglePasswordVisibility();
} }
void PasswordPendingView::OnContentChanged( void PasswordSaveUpdateView::OnContentChanged(
views::EditableCombobox* editable_combobox) { views::EditableCombobox* editable_combobox) {
bool is_update_state_before = controller_.IsCurrentStateUpdate(); bool is_update_state_before = controller_.IsCurrentStateUpdate();
bool is_ok_button_enabled_before = bool is_ok_button_enabled_before =
...@@ -385,14 +387,14 @@ void PasswordPendingView::OnContentChanged( ...@@ -385,14 +387,14 @@ void PasswordPendingView::OnContentChanged(
} }
} }
gfx::Size PasswordPendingView::CalculatePreferredSize() const { gfx::Size PasswordSaveUpdateView::CalculatePreferredSize() const {
const int width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_BUBBLE_PREFERRED_WIDTH) - DISTANCE_BUBBLE_PREFERRED_WIDTH) -
margins().width(); margins().width();
return gfx::Size(width, GetHeightForWidth(width)); return gfx::Size(width, GetHeightForWidth(width));
} }
views::View* PasswordPendingView::GetInitiallyFocusedView() { views::View* PasswordSaveUpdateView::GetInitiallyFocusedView() {
if (username_dropdown_ && username_dropdown_->GetText().empty()) if (username_dropdown_ && username_dropdown_->GetText().empty())
return username_dropdown_; return username_dropdown_;
View* initial_view = PasswordBubbleViewBase::GetInitiallyFocusedView(); View* initial_view = PasswordBubbleViewBase::GetInitiallyFocusedView();
...@@ -404,37 +406,38 @@ views::View* PasswordPendingView::GetInitiallyFocusedView() { ...@@ -404,37 +406,38 @@ views::View* PasswordPendingView::GetInitiallyFocusedView() {
return (initial_view && initial_view->IsFocusable()) ? initial_view : nullptr; return (initial_view && initial_view->IsFocusable()) ? initial_view : nullptr;
} }
bool PasswordPendingView::IsDialogButtonEnabled(ui::DialogButton button) const { bool PasswordSaveUpdateView::IsDialogButtonEnabled(
ui::DialogButton button) const {
return button != ui::DIALOG_BUTTON_OK || return button != ui::DIALOG_BUTTON_OK ||
controller_.pending_password().IsFederatedCredential() || controller_.pending_password().IsFederatedCredential() ||
!controller_.pending_password().password_value.empty(); !controller_.pending_password().password_value.empty();
} }
gfx::ImageSkia PasswordPendingView::GetWindowIcon() { gfx::ImageSkia PasswordSaveUpdateView::GetWindowIcon() {
return gfx::ImageSkia(); return gfx::ImageSkia();
} }
bool PasswordPendingView::ShouldShowWindowIcon() const { bool PasswordSaveUpdateView::ShouldShowWindowIcon() const {
return false; return false;
} }
bool PasswordPendingView::ShouldShowCloseButton() const { bool PasswordSaveUpdateView::ShouldShowCloseButton() const {
return true; return true;
} }
void PasswordPendingView::AddedToWidget() { void PasswordSaveUpdateView::AddedToWidget() {
static_cast<views::Label*>(GetBubbleFrameView()->title()) static_cast<views::Label*>(GetBubbleFrameView()->title())
->SetAllowCharacterBreak(true); ->SetAllowCharacterBreak(true);
} }
void PasswordPendingView::OnThemeChanged() { void PasswordSaveUpdateView::OnThemeChanged() {
if (int id = controller_.GetTopIllustration( if (int id = controller_.GetTopIllustration(
color_utils::IsDark(GetBubbleFrameView()->GetBackgroundColor()))) { color_utils::IsDark(GetBubbleFrameView()->GetBackgroundColor()))) {
GetBubbleFrameView()->SetHeaderView(CreateHeaderImage(id)); GetBubbleFrameView()->SetHeaderView(CreateHeaderImage(id));
} }
} }
void PasswordPendingView::TogglePasswordVisibility() { void PasswordSaveUpdateView::TogglePasswordVisibility() {
if (!are_passwords_revealed_ && !controller_.RevealPasswords()) if (!are_passwords_revealed_ && !controller_.RevealPasswords())
return; return;
...@@ -444,7 +447,7 @@ void PasswordPendingView::TogglePasswordVisibility() { ...@@ -444,7 +447,7 @@ void PasswordPendingView::TogglePasswordVisibility() {
password_dropdown_->RevealPasswords(are_passwords_revealed_); password_dropdown_->RevealPasswords(are_passwords_revealed_);
} }
void PasswordPendingView::UpdateUsernameAndPasswordInModel() { void PasswordSaveUpdateView::UpdateUsernameAndPasswordInModel() {
if (!username_dropdown_ && !password_dropdown_) if (!username_dropdown_ && !password_dropdown_)
return; return;
base::string16 new_username = controller_.pending_password().username_value; base::string16 new_username = controller_.pending_password().username_value;
...@@ -459,7 +462,7 @@ void PasswordPendingView::UpdateUsernameAndPasswordInModel() { ...@@ -459,7 +462,7 @@ void PasswordPendingView::UpdateUsernameAndPasswordInModel() {
std::move(new_password)); std::move(new_password));
} }
void PasswordPendingView::ReplaceWithPromo() { void PasswordSaveUpdateView::ReplaceWithPromo() {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
NOTREACHED(); NOTREACHED();
#else #else
...@@ -488,7 +491,7 @@ void PasswordPendingView::ReplaceWithPromo() { ...@@ -488,7 +491,7 @@ void PasswordPendingView::ReplaceWithPromo() {
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
} }
void PasswordPendingView::UpdateDialogButtons() { void PasswordSaveUpdateView::UpdateDialogButtons() {
if (sign_in_promo_) { if (sign_in_promo_) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE); DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
return; return;
...@@ -507,7 +510,7 @@ void PasswordPendingView::UpdateDialogButtons() { ...@@ -507,7 +510,7 @@ void PasswordPendingView::UpdateDialogButtons() {
: IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); : IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON));
} }
std::unique_ptr<views::View> PasswordPendingView::CreateFooterView() { std::unique_ptr<views::View> PasswordSaveUpdateView::CreateFooterView() {
if (!controller_.ShouldShowFooter()) if (!controller_.ShouldShowFooter())
return nullptr; return nullptr;
auto label = std::make_unique<views::Label>( auto label = std::make_unique<views::Label>(
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_PENDING_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_SAVE_UPDATE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_PENDING_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_SAVE_UPDATE_VIEW_H_
#include "chrome/browser/ui/passwords/bubble_controllers/pending_bubble_controller.h" #include "chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller.h"
#include "chrome/browser/ui/views/passwords/password_bubble_view_base.h" #include "chrome/browser/ui/views/passwords/password_bubble_view_base.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/controls/editable_combobox/editable_combobox_listener.h" #include "ui/views/controls/editable_combobox/editable_combobox_listener.h"
...@@ -25,18 +25,18 @@ class PasswordSignInPromoView; ...@@ -25,18 +25,18 @@ class PasswordSignInPromoView;
// A view offering the user the ability to save or update credentials (depending // A view offering the user the ability to save or update credentials (depending
// on |is_update_bubble|). Contains a username and password field, along with a // on |is_update_bubble|). Contains a username and password field, along with a
// "Save"/"Update" button and a "Never"/"Nope" button. // "Save"/"Update" button and a "Never"/"Nope" button.
class PasswordPendingView : public PasswordBubbleViewBase, class PasswordSaveUpdateView : public PasswordBubbleViewBase,
public views::ButtonListener, public views::ButtonListener,
public views::EditableComboboxListener { public views::EditableComboboxListener {
public: public:
PasswordPendingView(content::WebContents* web_contents, PasswordSaveUpdateView(content::WebContents* web_contents,
views::View* anchor_view, views::View* anchor_view,
DisplayReason reason); DisplayReason reason);
views::View* GetUsernameTextfieldForTest() const; views::View* GetUsernameTextfieldForTest() const;
private: private:
~PasswordPendingView() override; ~PasswordSaveUpdateView() override;
// PasswordBubbleViewBase // PasswordBubbleViewBase
PasswordBubbleControllerBase* GetController() override; PasswordBubbleControllerBase* GetController() override;
...@@ -70,7 +70,7 @@ class PasswordPendingView : public PasswordBubbleViewBase, ...@@ -70,7 +70,7 @@ class PasswordPendingView : public PasswordBubbleViewBase,
void UpdateDialogButtons(); void UpdateDialogButtons();
std::unique_ptr<views::View> CreateFooterView(); std::unique_ptr<views::View> CreateFooterView();
PendingBubbleController controller_; SaveUpdateBubbleController controller_;
// True iff it is an update password bubble on creation. False iff it is a // True iff it is an update password bubble on creation. False iff it is a
// save bubble. // save bubble.
...@@ -92,8 +92,6 @@ class PasswordPendingView : public PasswordBubbleViewBase, ...@@ -92,8 +92,6 @@ class PasswordPendingView : public PasswordBubbleViewBase,
#endif // defined(PASSWORD_STORE_SELECT_ENABLED) #endif // defined(PASSWORD_STORE_SELECT_ENABLED)
bool are_passwords_revealed_; bool are_passwords_revealed_;
DISALLOW_COPY_AND_ASSIGN(PasswordPendingView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_PENDING_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_SAVE_UPDATE_VIEW_H_
...@@ -4058,7 +4058,7 @@ test("unit_tests") { ...@@ -4058,7 +4058,7 @@ test("unit_tests") {
"../browser/ui/passwords/bubble_controllers/auto_sign_in_bubble_controller_unittest.cc", "../browser/ui/passwords/bubble_controllers/auto_sign_in_bubble_controller_unittest.cc",
"../browser/ui/passwords/bubble_controllers/generation_confirmation_bubble_controller_unittest.cc", "../browser/ui/passwords/bubble_controllers/generation_confirmation_bubble_controller_unittest.cc",
"../browser/ui/passwords/bubble_controllers/items_bubble_controller_unittest.cc", "../browser/ui/passwords/bubble_controllers/items_bubble_controller_unittest.cc",
"../browser/ui/passwords/bubble_controllers/pending_bubble_controller_unittest.cc", "../browser/ui/passwords/bubble_controllers/save_update_bubble_controller_unittest.cc",
"../browser/ui/passwords/bubble_controllers/sign_in_promo_bubble_controller_unittest.cc", "../browser/ui/passwords/bubble_controllers/sign_in_promo_bubble_controller_unittest.cc",
"../browser/ui/passwords/credential_leak_dialog_controller_impl_unittest.cc", "../browser/ui/passwords/credential_leak_dialog_controller_impl_unittest.cc",
"../browser/ui/passwords/credential_manager_dialog_controller_impl_unittest.cc", "../browser/ui/passwords/credential_manager_dialog_controller_impl_unittest.cc",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment