Commit 34f6f613 authored by Vasilii Sukhanov's avatar Vasilii Sukhanov Committed by Commit Bot

Add a tooltip to the password leak detection dialog on desktop.

Bug: 1028095
Change-Id: I4f954414aa51f67f38185eca3df4595e0a8b77d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1936255Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719204}
parent 1baad057
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/grit/theme_resources.h" #include "chrome/grit/theme_resources.h"
#include "components/constrained_window/constrained_window_views.h" #include "components/constrained_window/constrained_window_views.h"
#include "components/password_manager/core/browser/leak_detection_dialog_utils.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/bubble/tooltip_icon.h"
#include "ui/views/controls/styled_label.h" #include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
...@@ -86,6 +88,17 @@ std::unique_ptr<views::View> CreateContent(const base::string16& title, ...@@ -86,6 +88,17 @@ std::unique_ptr<views::View> CreateContent(const base::string16& title,
return content; return content;
} }
std::unique_ptr<views::TooltipIcon> CreateInfoIcon() {
auto explanation_tooltip = std::make_unique<views::TooltipIcon>(
password_manager::GetLeakDetectionTooltip());
explanation_tooltip->set_bubble_width(
ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_BUBBLE_PREFERRED_WIDTH));
explanation_tooltip->set_anchor_point_arrow(
views::BubbleBorder::Arrow::TOP_RIGHT);
return explanation_tooltip;
}
} // namespace } // namespace
CredentialLeakDialogView::CredentialLeakDialogView( CredentialLeakDialogView::CredentialLeakDialogView(
...@@ -177,6 +190,7 @@ void CredentialLeakDialogView::InitWindow() { ...@@ -177,6 +190,7 @@ void CredentialLeakDialogView::InitWindow() {
CreateContent(controller_->GetTitle(), controller_->GetDescription()); CreateContent(controller_->GetTitle(), controller_->GetDescription());
AddChildView(std::move(illustration)); AddChildView(std::move(illustration));
AddChildView(std::move(content)); AddChildView(std::move(content));
SetExtraView(CreateInfoIcon());
} }
CredentialLeakPrompt* CreateCredentialLeakPromptView( CredentialLeakPrompt* CreateCredentialLeakPromptView(
......
...@@ -95,6 +95,10 @@ base::string16 GetTitle(CredentialLeakType leak_type) { ...@@ -95,6 +95,10 @@ base::string16 GetTitle(CredentialLeakType leak_type) {
: IDS_CREDENTIAL_LEAK_TITLE_CHANGE); : IDS_CREDENTIAL_LEAK_TITLE_CHANGE);
} }
base::string16 GetLeakDetectionTooltip() {
return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_LEAK_HELP_MESSAGE);
}
bool ShouldCheckPasswords(CredentialLeakType leak_type) { bool ShouldCheckPasswords(CredentialLeakType leak_type) {
return password_manager::IsPasswordUsedOnOtherSites(leak_type) && return password_manager::IsPasswordUsedOnOtherSites(leak_type) &&
password_manager::IsSyncingPasswordsNormally(leak_type); password_manager::IsSyncingPasswordsNormally(leak_type);
......
...@@ -62,6 +62,9 @@ base::string16 GetDescription(password_manager::CredentialLeakType leak_type, ...@@ -62,6 +62,9 @@ base::string16 GetDescription(password_manager::CredentialLeakType leak_type,
// Returns the leak dialog title based on leak type. // Returns the leak dialog title based on leak type.
base::string16 GetTitle(password_manager::CredentialLeakType leak_type); base::string16 GetTitle(password_manager::CredentialLeakType leak_type);
// Returns the leak dialog tooltip shown on (?) click.
base::string16 GetLeakDetectionTooltip();
// Checks whether the leak dialog should prompt user to password checkup. // Checks whether the leak dialog should prompt user to password checkup.
bool ShouldCheckPasswords(password_manager::CredentialLeakType leak_type); bool ShouldCheckPasswords(password_manager::CredentialLeakType leak_type);
......
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