Commit 103872b1 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

[Passwords] Rename *SaveConfirmation* to *GenerationConfirmation*

This a purely mechnical CL that renames some classes to better represent
their semantics

Bug: 1044034
Change-Id: Ie3135591ca3cb9a8313fa40a81ca38b227ccb93c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2019029
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735010}
parent bde7f92c
...@@ -1052,10 +1052,10 @@ jumbo_static_library("ui") { ...@@ -1052,10 +1052,10 @@ jumbo_static_library("ui") {
"page_info/permission_menu_model.h", "page_info/permission_menu_model.h",
"passwords/bubble_controllers/auto_sign_in_bubble_controller.cc", "passwords/bubble_controllers/auto_sign_in_bubble_controller.cc",
"passwords/bubble_controllers/auto_sign_in_bubble_controller.h", "passwords/bubble_controllers/auto_sign_in_bubble_controller.h",
"passwords/bubble_controllers/generation_confirmation_bubble_controller.cc",
"passwords/bubble_controllers/generation_confirmation_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/save_confirmation_bubble_controller.cc",
"passwords/bubble_controllers/save_confirmation_bubble_controller.h",
"passwords/credential_leak_dialog_controller.h", "passwords/credential_leak_dialog_controller.h",
"passwords/credential_leak_dialog_controller_impl.cc", "passwords/credential_leak_dialog_controller_impl.cc",
"passwords/credential_leak_dialog_controller_impl.h", "passwords/credential_leak_dialog_controller_impl.h",
...@@ -3104,14 +3104,14 @@ jumbo_static_library("ui") { ...@@ -3104,14 +3104,14 @@ jumbo_static_library("ui") {
"views/passwords/password_auto_sign_in_view.h", "views/passwords/password_auto_sign_in_view.h",
"views/passwords/password_bubble_view_base.cc", "views/passwords/password_bubble_view_base.cc",
"views/passwords/password_bubble_view_base.h", "views/passwords/password_bubble_view_base.h",
"views/passwords/password_generation_confirmation_view.cc",
"views/passwords/password_generation_confirmation_view.h",
"views/passwords/password_generation_popup_view_views.cc", "views/passwords/password_generation_popup_view_views.cc",
"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_pending_view.cc",
"views/passwords/password_pending_view.h", "views/passwords/password_pending_view.h",
"views/passwords/password_save_confirmation_view.cc",
"views/passwords/password_save_confirmation_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/save_confirmation_bubble_controller.h" #include "chrome/browser/ui/passwords/bubble_controllers/generation_confirmation_bubble_controller.h"
#include "chrome/browser/ui/passwords/passwords_model_delegate.h" #include "chrome/browser/ui/passwords/passwords_model_delegate.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace metrics_util = password_manager::metrics_util; namespace metrics_util = password_manager::metrics_util;
SaveConfirmationBubbleController::SaveConfirmationBubbleController( GenerationConfirmationBubbleController::GenerationConfirmationBubbleController(
base::WeakPtr<PasswordsModelDelegate> delegate, base::WeakPtr<PasswordsModelDelegate> delegate,
ManagePasswordsBubbleModel::DisplayReason display_reason) ManagePasswordsBubbleModel::DisplayReason display_reason)
: PasswordBubbleControllerBase( : PasswordBubbleControllerBase(
...@@ -28,12 +28,13 @@ SaveConfirmationBubbleController::SaveConfirmationBubbleController( ...@@ -28,12 +28,13 @@ SaveConfirmationBubbleController::SaveConfirmationBubbleController(
save_confirmation_link_range_ = gfx::Range(offset, offset + link.length()); save_confirmation_link_range_ = gfx::Range(offset, offset + link.length());
} }
SaveConfirmationBubbleController::~SaveConfirmationBubbleController() { GenerationConfirmationBubbleController::
~GenerationConfirmationBubbleController() {
if (!interaction_reported_) if (!interaction_reported_)
OnBubbleClosing(); OnBubbleClosing();
} }
void SaveConfirmationBubbleController:: void GenerationConfirmationBubbleController::
OnNavigateToPasswordManagerAccountDashboardLinkClicked( OnNavigateToPasswordManagerAccountDashboardLinkClicked(
password_manager::ManagePasswordsReferrer referrer) { password_manager::ManagePasswordsReferrer referrer) {
dismissal_reason_ = metrics_util::CLICKED_PASSWORDS_DASHBOARD; dismissal_reason_ = metrics_util::CLICKED_PASSWORDS_DASHBOARD;
...@@ -41,11 +42,11 @@ void SaveConfirmationBubbleController:: ...@@ -41,11 +42,11 @@ void SaveConfirmationBubbleController::
delegate_->NavigateToPasswordManagerAccountDashboard(referrer); delegate_->NavigateToPasswordManagerAccountDashboard(referrer);
} }
base::string16 SaveConfirmationBubbleController::GetTitle() const { base::string16 GenerationConfirmationBubbleController::GetTitle() const {
return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CONFIRM_SAVED_TITLE); return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CONFIRM_SAVED_TITLE);
} }
void SaveConfirmationBubbleController::ReportInteractions() { void GenerationConfirmationBubbleController::ReportInteractions() {
metrics_util::LogGeneralUIDismissalReason(dismissal_reason_); metrics_util::LogGeneralUIDismissalReason(dismissal_reason_);
// Record UKM statistics on dismissal reason. // Record UKM statistics on dismissal reason.
if (metrics_recorder_) if (metrics_recorder_)
......
...@@ -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_SAVE_CONFIRMATION_BUBBLE_CONTROLLER_H_ #ifndef CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_GENERATION_CONFIRMATION_BUBBLE_CONTROLLER_H_
#define CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_SAVE_CONFIRMATION_BUBBLE_CONTROLLER_H_ #define CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_GENERATION_CONFIRMATION_BUBBLE_CONTROLLER_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"
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
#include "ui/gfx/range/range.h" #include "ui/gfx/range/range.h"
// This controller provides data and actions for the // This controller provides data and actions for the
// PasswordSaveConfirmationView. // PasswordGenerationConfirmationView.
class SaveConfirmationBubbleController : public PasswordBubbleControllerBase { class GenerationConfirmationBubbleController
: public PasswordBubbleControllerBase {
public: public:
SaveConfirmationBubbleController( GenerationConfirmationBubbleController(
base::WeakPtr<PasswordsModelDelegate> delegate, base::WeakPtr<PasswordsModelDelegate> delegate,
ManagePasswordsBubbleModel::DisplayReason display_reason); ManagePasswordsBubbleModel::DisplayReason display_reason);
~SaveConfirmationBubbleController() override; ~GenerationConfirmationBubbleController() override;
// Called by the view code when the navigate to passwords.google.com link is // Called by the view code when the navigate to passwords.google.com link is
// clicked by the user. // clicked by the user.
...@@ -43,4 +44,4 @@ class SaveConfirmationBubbleController : public PasswordBubbleControllerBase { ...@@ -43,4 +44,4 @@ class SaveConfirmationBubbleController : public PasswordBubbleControllerBase {
password_manager::metrics_util::UIDismissalReason dismissal_reason_; password_manager::metrics_util::UIDismissalReason dismissal_reason_;
}; };
#endif // CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_SAVE_CONFIRMATION_BUBBLE_CONTROLLER_H_ #endif // CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_GENERATION_CONFIRMATION_BUBBLE_CONTROLLER_H_
...@@ -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/save_confirmation_bubble_controller.h" #include "chrome/browser/ui/passwords/bubble_controllers/generation_confirmation_bubble_controller.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
...@@ -20,39 +20,41 @@ constexpr char kUIDismissalReasonGeneralMetric[] = ...@@ -20,39 +20,41 @@ constexpr char kUIDismissalReasonGeneralMetric[] =
} // namespace } // namespace
class SaveConfirmationBubbleControllerTest : public ::testing::Test { class GenerationConfirmationBubbleControllerTest : public ::testing::Test {
public: public:
SaveConfirmationBubbleControllerTest() { GenerationConfirmationBubbleControllerTest() {
mock_delegate_ = mock_delegate_ =
std::make_unique<testing::NiceMock<PasswordsModelDelegateMock>>(); std::make_unique<testing::NiceMock<PasswordsModelDelegateMock>>();
ON_CALL(*mock_delegate_, GetPasswordFormMetricsRecorder()) ON_CALL(*mock_delegate_, GetPasswordFormMetricsRecorder())
.WillByDefault(Return(nullptr)); .WillByDefault(Return(nullptr));
} }
~SaveConfirmationBubbleControllerTest() override = default; ~GenerationConfirmationBubbleControllerTest() override = default;
PasswordsModelDelegateMock* delegate() { return mock_delegate_.get(); } PasswordsModelDelegateMock* delegate() { return mock_delegate_.get(); }
SaveConfirmationBubbleController* controller() { return controller_.get(); } GenerationConfirmationBubbleController* controller() {
return controller_.get();
}
void Init(); void Init();
void DestroyController(); void DestroyController();
private: private:
std::unique_ptr<PasswordsModelDelegateMock> mock_delegate_; std::unique_ptr<PasswordsModelDelegateMock> mock_delegate_;
std::unique_ptr<SaveConfirmationBubbleController> controller_; std::unique_ptr<GenerationConfirmationBubbleController> controller_;
}; };
void SaveConfirmationBubbleControllerTest::Init() { void GenerationConfirmationBubbleControllerTest::Init() {
EXPECT_CALL(*delegate(), OnBubbleShown()); EXPECT_CALL(*delegate(), OnBubbleShown());
controller_.reset(new SaveConfirmationBubbleController( controller_.reset(new GenerationConfirmationBubbleController(
mock_delegate_->AsWeakPtr(), ManagePasswordsBubbleModel::AUTOMATIC)); mock_delegate_->AsWeakPtr(), ManagePasswordsBubbleModel::AUTOMATIC));
ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(delegate())); ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(delegate()));
} }
void SaveConfirmationBubbleControllerTest::DestroyController() { void GenerationConfirmationBubbleControllerTest::DestroyController() {
controller_.reset(); controller_.reset();
} }
TEST_F(SaveConfirmationBubbleControllerTest, TEST_F(GenerationConfirmationBubbleControllerTest,
NavigateToDashboardWithBubbleClosing) { NavigateToDashboardWithBubbleClosing) {
Init(); Init();
...@@ -71,7 +73,7 @@ TEST_F(SaveConfirmationBubbleControllerTest, ...@@ -71,7 +73,7 @@ TEST_F(SaveConfirmationBubbleControllerTest,
password_manager::metrics_util::CLICKED_PASSWORDS_DASHBOARD, 1); password_manager::metrics_util::CLICKED_PASSWORDS_DASHBOARD, 1);
} }
TEST_F(SaveConfirmationBubbleControllerTest, TEST_F(GenerationConfirmationBubbleControllerTest,
NavigateToDashboardWithoutBubbleClosing) { NavigateToDashboardWithoutBubbleClosing) {
Init(); Init();
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
#include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_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_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_pending_view.h"
#include "chrome/browser/ui/views/passwords/password_save_confirmation_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"
...@@ -66,7 +66,8 @@ PasswordBubbleViewBase* PasswordBubbleViewBase::CreateBubble( ...@@ -66,7 +66,8 @@ PasswordBubbleViewBase* PasswordBubbleViewBase::CreateBubble(
} else if (model_state == password_manager::ui::AUTO_SIGNIN_STATE) { } else if (model_state == password_manager::ui::AUTO_SIGNIN_STATE) {
view = new PasswordAutoSignInView(web_contents, anchor_view, reason); view = new PasswordAutoSignInView(web_contents, anchor_view, reason);
} else if (model_state == password_manager::ui::CONFIRMATION_STATE) { } else if (model_state == password_manager::ui::CONFIRMATION_STATE) {
view = new PasswordSaveConfirmationView(web_contents, anchor_view, reason); view = new PasswordGenerationConfirmationView(web_contents, anchor_view,
reason);
} 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) {
......
...@@ -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_save_confirmation_view.h" #include "chrome/browser/ui/views/passwords/password_generation_confirmation_view.h"
#include <memory> #include <memory>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "ui/views/controls/styled_label.h" #include "ui/views/controls/styled_label.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
PasswordSaveConfirmationView::PasswordSaveConfirmationView( PasswordGenerationConfirmationView::PasswordGenerationConfirmationView(
content::WebContents* web_contents, content::WebContents* web_contents,
views::View* anchor_view, views::View* anchor_view,
DisplayReason reason) DisplayReason reason)
...@@ -43,22 +43,24 @@ PasswordSaveConfirmationView::PasswordSaveConfirmationView( ...@@ -43,22 +43,24 @@ PasswordSaveConfirmationView::PasswordSaveConfirmationView(
AddChildView(label.release()); AddChildView(label.release());
} }
PasswordSaveConfirmationView::~PasswordSaveConfirmationView() = default; PasswordGenerationConfirmationView::~PasswordGenerationConfirmationView() =
default;
PasswordBubbleControllerBase* PasswordSaveConfirmationView::GetController() { PasswordBubbleControllerBase*
PasswordGenerationConfirmationView::GetController() {
return &controller_; return &controller_;
} }
const PasswordBubbleControllerBase* const PasswordBubbleControllerBase*
PasswordSaveConfirmationView::GetController() const { PasswordGenerationConfirmationView::GetController() const {
return &controller_; return &controller_;
} }
bool PasswordSaveConfirmationView::ShouldShowCloseButton() const { bool PasswordGenerationConfirmationView::ShouldShowCloseButton() const {
return true; return true;
} }
void PasswordSaveConfirmationView::StyledLabelLinkClicked( void PasswordGenerationConfirmationView::StyledLabelLinkClicked(
views::StyledLabel* label, views::StyledLabel* label,
const gfx::Range& range, const gfx::Range& range,
int event_flags) { int event_flags) {
...@@ -69,7 +71,7 @@ void PasswordSaveConfirmationView::StyledLabelLinkClicked( ...@@ -69,7 +71,7 @@ void PasswordSaveConfirmationView::StyledLabelLinkClicked(
CloseBubble(); CloseBubble();
} }
gfx::Size PasswordSaveConfirmationView::CalculatePreferredSize() const { gfx::Size PasswordGenerationConfirmationView::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();
......
...@@ -2,23 +2,24 @@ ...@@ -2,23 +2,24 @@
// 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_SAVE_CONFIRMATION_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_GENERATION_CONFIRMATION_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_SAVE_CONFIRMATION_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_GENERATION_CONFIRMATION_VIEW_H_
#include "chrome/browser/ui/passwords/bubble_controllers/save_confirmation_bubble_controller.h" #include "chrome/browser/ui/passwords/bubble_controllers/generation_confirmation_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/styled_label_listener.h" #include "ui/views/controls/styled_label_listener.h"
#include "ui/views/view.h" #include "ui/views/view.h"
// A view confirming to the user that a password was saved and offering a link // A view confirming to the user that a generated password was saved and
// to the Google account manager. // offering a link to the Google account manager.
class PasswordSaveConfirmationView : public PasswordBubbleViewBase, class PasswordGenerationConfirmationView : public PasswordBubbleViewBase,
public views::StyledLabelListener { public views::StyledLabelListener {
public: public:
explicit PasswordSaveConfirmationView(content::WebContents* web_contents, explicit PasswordGenerationConfirmationView(
views::View* anchor_view, content::WebContents* web_contents,
DisplayReason reason); views::View* anchor_view,
~PasswordSaveConfirmationView() override; DisplayReason reason);
~PasswordGenerationConfirmationView() override;
private: private:
// PasswordBubbleViewBase // PasswordBubbleViewBase
...@@ -34,9 +35,9 @@ class PasswordSaveConfirmationView : public PasswordBubbleViewBase, ...@@ -34,9 +35,9 @@ class PasswordSaveConfirmationView : public PasswordBubbleViewBase,
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
SaveConfirmationBubbleController controller_; GenerationConfirmationBubbleController controller_;
DISALLOW_COPY_AND_ASSIGN(PasswordSaveConfirmationView); DISALLOW_COPY_AND_ASSIGN(PasswordGenerationConfirmationView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_SAVE_CONFIRMATION_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_GENERATION_CONFIRMATION_VIEW_H_
...@@ -4032,7 +4032,7 @@ test("unit_tests") { ...@@ -4032,7 +4032,7 @@ test("unit_tests") {
"../browser/ui/omnibox/clipboard_utils_unittest.cc", "../browser/ui/omnibox/clipboard_utils_unittest.cc",
"../browser/ui/page_info/permission_menu_model_unittest.cc", "../browser/ui/page_info/permission_menu_model_unittest.cc",
"../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/save_confirmation_bubble_controller_unittest.cc", "../browser/ui/passwords/bubble_controllers/generation_confirmation_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",
"../browser/ui/passwords/manage_passwords_bubble_model_unittest.cc", "../browser/ui/passwords/manage_passwords_bubble_model_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