Commit a3dcf9ef authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Misc. cleanup.

Bug: none
Change-Id: I391f332af03db0d79877b0983c2060fc3f6bfaf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2385239
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805834}
parent 6f927f8c
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "ash/app_list/views/privacy_info_view.h" #include "ash/app_list/views/privacy_info_view.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/controls/styled_label_listener.h"
namespace ash { namespace ash {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "ash/app_list/views/privacy_info_view.h" #include "ash/app_list/views/privacy_info_view.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/controls/styled_label_listener.h"
namespace ash { namespace ash {
......
...@@ -1979,7 +1979,7 @@ void LockContentsView::ShowAuthErrorMessage() { ...@@ -1979,7 +1979,7 @@ void LockContentsView::ShowAuthErrorMessage() {
*bold_start += shortcut_offset_in_string; *bold_start += shortcut_offset_in_string;
} }
auto label = std::make_unique<views::StyledLabel>(this); auto label = std::make_unique<views::StyledLabel>();
label->SetText(error_text); label->SetText(error_text);
MakeSectionBold(label.get(), error_text, bold_start, bold_length); MakeSectionBold(label.get(), error_text, bold_start, bold_length);
label->SetAutoColorReadabilityEnabled(false); label->SetAutoColorReadabilityEnabled(false);
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "chromeos/dbus/power_manager/power_supply_properties.pb.h" #include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
#include "ui/display/display_observer.h" #include "ui/display/display_observer.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/views/controls/styled_label_listener.h"
#include "ui/views/metadata/metadata_header_macros.h" #include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -42,7 +41,6 @@ class KeyboardUIController; ...@@ -42,7 +41,6 @@ class KeyboardUIController;
namespace views { namespace views {
class BoxLayout; class BoxLayout;
class StyledLabel;
} // namespace views } // namespace views
namespace ash { namespace ash {
...@@ -69,7 +67,6 @@ class ASH_EXPORT LockContentsView ...@@ -69,7 +67,6 @@ class ASH_EXPORT LockContentsView
public LoginDataDispatcher::Observer, public LoginDataDispatcher::Observer,
public SystemTrayFocusObserver, public SystemTrayFocusObserver,
public display::DisplayObserver, public display::DisplayObserver,
public views::StyledLabelListener,
public KeyboardControllerObserver, public KeyboardControllerObserver,
public chromeos::PowerManagerClient::Observer { public chromeos::PowerManagerClient::Observer {
public: public:
...@@ -213,11 +210,6 @@ class ASH_EXPORT LockContentsView ...@@ -213,11 +210,6 @@ class ASH_EXPORT LockContentsView
void OnDisplayMetricsChanged(const display::Display& display, void OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) override; uint32_t changed_metrics) override;
// views::StyledLabelListener:
void StyledLabelLinkClicked(views::StyledLabel* label,
const gfx::Range& range,
int event_flags) override {}
// KeyboardControllerObserver: // KeyboardControllerObserver:
void OnKeyboardVisibilityChanged(bool is_visible) override; void OnKeyboardVisibilityChanged(bool is_visible) override;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "ui/views/controls/styled_label_listener.h" #include "ui/views/controls/styled_label_listener.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
namespace ash { namespace ash {
namespace { namespace {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "components/sync/protocol/device_info_specifics.pb.h" #include "components/sync/protocol/device_info_specifics.pb.h"
#include "components/sync_device_info/device_info.h" #include "components/sync_device_info/device_info.h"
#include "ui/views/controls/styled_label.h" #include "ui/views/controls/styled_label.h"
#include "ui/views/controls/styled_label_listener.h"
#include "url/origin.h" #include "url/origin.h"
class SharingDialog; class SharingDialog;
......
...@@ -191,27 +191,13 @@ void AppUninstallDialogView::InitializeView(Profile* profile, ...@@ -191,27 +191,13 @@ void AppUninstallDialogView::InitializeView(Profile* profile,
} }
void AppUninstallDialogView::InitializeCheckbox(const GURL& app_launch_url) { void AppUninstallDialogView::InitializeCheckbox(const GURL& app_launch_url) {
std::unique_ptr<views::StyledLabel> checkbox_label;
std::vector<base::string16> replacements; std::vector<base::string16> replacements;
size_t offset;
base::string16 learn_more_text =
l10n_util::GetStringUTF16(IDS_APP_UNINSTALL_PROMPT_LEARN_MORE);
replacements.push_back(url_formatter::FormatUrlForSecurityDisplay( replacements.push_back(url_formatter::FormatUrlForSecurityDisplay(
app_launch_url, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); app_launch_url, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC));
if (google_util::IsGoogleHostname(app_launch_url.host_piece(), const bool is_google = google_util::IsGoogleHostname(
google_util::ALLOW_SUBDOMAIN)) { app_launch_url.host_piece(), google_util::ALLOW_SUBDOMAIN);
replacements.push_back(learn_more_text); if (!is_google) {
checkbox_label = std::make_unique<views::StyledLabel>(this);
std::vector<size_t> offsets;
checkbox_label->SetText(l10n_util::GetStringFUTF16(
IDS_APP_UNINSTALL_PROMPT_REMOVE_DATA_CHECKBOX_FOR_GOOGLE, replacements,
&offsets));
DCHECK_EQ(replacements.size(), offsets.size());
offset = offsets.back();
} else {
auto domain = net::registry_controlled_domains::GetDomainAndRegistry( auto domain = net::registry_controlled_domains::GetDomainAndRegistry(
app_launch_url, app_launch_url,
net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
...@@ -219,17 +205,21 @@ void AppUninstallDialogView::InitializeCheckbox(const GURL& app_launch_url) { ...@@ -219,17 +205,21 @@ void AppUninstallDialogView::InitializeCheckbox(const GURL& app_launch_url) {
domain[0] = base::ToUpperASCII(domain[0]); domain[0] = base::ToUpperASCII(domain[0]);
replacements.push_back(base::ASCIIToUTF16(domain)); replacements.push_back(base::ASCIIToUTF16(domain));
replacements.push_back(learn_more_text);
checkbox_label = std::make_unique<views::StyledLabel>(this);
std::vector<size_t> offsets;
checkbox_label->SetText(l10n_util::GetStringFUTF16(
IDS_APP_UNINSTALL_PROMPT_REMOVE_DATA_CHECKBOX_FOR_NON_GOOGLE,
replacements, &offsets));
DCHECK_EQ(replacements.size(), offsets.size());
offset = offsets.back();
} }
base::string16 learn_more_text =
l10n_util::GetStringUTF16(IDS_APP_UNINSTALL_PROMPT_LEARN_MORE);
replacements.push_back(learn_more_text);
auto checkbox_label = std::make_unique<views::StyledLabel>(this);
std::vector<size_t> offsets;
checkbox_label->SetText(l10n_util::GetStringFUTF16(
is_google ? IDS_APP_UNINSTALL_PROMPT_REMOVE_DATA_CHECKBOX_FOR_GOOGLE
: IDS_APP_UNINSTALL_PROMPT_REMOVE_DATA_CHECKBOX_FOR_NON_GOOGLE,
replacements, &offsets));
DCHECK_EQ(replacements.size(), offsets.size());
const size_t offset = offsets.back();
checkbox_label->AddStyleRange( checkbox_label->AddStyleRange(
gfx::Range(offset, offset + learn_more_text.length()), gfx::Range(offset, offset + learn_more_text.length()),
views::StyledLabel::RangeStyleInfo::CreateForLink()); views::StyledLabel::RangeStyleInfo::CreateForLink());
......
...@@ -305,14 +305,13 @@ class LocalCardMigrationOfferView : public views::View { ...@@ -305,14 +305,13 @@ class LocalCardMigrationOfferView : public views::View {
AddChildView(new views::Separator()); AddChildView(new views::Separator());
legal_message_container_ = new LegalMessageView( legal_message_container_ = AddChildView(std::make_unique<LegalMessageView>(
controller->GetLegalMessageLines(), controller->GetLegalMessageLines(),
base::BindRepeating( base::BindRepeating(
&LocalCardMigrationDialogController::OnLegalMessageLinkClicked, &LocalCardMigrationDialogController::OnLegalMessageLinkClicked,
base::Unretained(controller_))); base::Unretained(controller_))));
legal_message_container_->SetBorder( legal_message_container_->SetBorder(
views::CreateEmptyBorder(kMigrationDialogInsets)); views::CreateEmptyBorder(kMigrationDialogInsets));
AddChildView(legal_message_container_);
} }
~LocalCardMigrationOfferView() override {} ~LocalCardMigrationOfferView() override {}
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/autofill/payments/payments_view_util.h" #include "chrome/browser/ui/views/autofill/payments/payments_view_util.h"
#include "base/util/ranges/algorithm.h"
#include "build/branding_buildflags.h" #include "build/branding_buildflags.h"
#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
...@@ -148,26 +149,18 @@ LegalMessageView::LegalMessageView(const LegalMessageLines& legal_message_lines, ...@@ -148,26 +149,18 @@ LegalMessageView::LegalMessageView(const LegalMessageLines& legal_message_lines,
} }
} }
LegalMessageView::~LegalMessageView() {} LegalMessageView::~LegalMessageView() = default;
void LegalMessageView::StyledLabelLinkClicked(views::StyledLabel* label, void LegalMessageView::StyledLabelLinkClicked(views::StyledLabel* label,
const gfx::Range& range, const gfx::Range& range,
int event_flags) { int event_flags) {
// Index of |label| within its parent's view hierarchy is the same as the const int label_index = GetIndexOf(label);
// legal message line index. DCHECK this assumption to guard against future DCHECK_LT(size_t{label_index}, legal_message_lines_.size());
// layout changes. const auto& links = legal_message_lines_[label_index].links();
DCHECK_EQ(label->parent()->children().size(), legal_message_lines_.size()); const auto it =
util::ranges::find(links, range, &LegalMessageLine::Link::range);
const std::vector<LegalMessageLine::Link>& links = DCHECK(it != links.end());
legal_message_lines_[label->parent()->GetIndexOf(label)].links(); callback_.Run(it->url);
for (const LegalMessageLine::Link& link : links) {
if (link.range == range) {
callback_.Run(link.url);
return;
}
}
// |range| was not found.
NOTREACHED();
} }
PaymentsBubbleClosedReason GetPaymentsBubbleClosedReasonFromWidgetClosedReason( PaymentsBubbleClosedReason GetPaymentsBubbleClosedReasonFromWidgetClosedReason(
......
...@@ -42,6 +42,8 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews, ...@@ -42,6 +42,8 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews,
const base::string16& new_contents) override; const base::string16& new_contents) override;
private: private:
~SaveCardOfferBubbleViews() override;
std::unique_ptr<views::View> CreateMainContentView() override; std::unique_ptr<views::View> CreateMainContentView() override;
std::unique_ptr<views::View> CreateRequestExpirationDateView(); std::unique_ptr<views::View> CreateRequestExpirationDateView();
...@@ -49,8 +51,6 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews, ...@@ -49,8 +51,6 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews,
void LinkClicked(const GURL& url); void LinkClicked(const GURL& url);
~SaveCardOfferBubbleViews() override;
views::Textfield* cardholder_name_textfield_ = nullptr; views::Textfield* cardholder_name_textfield_ = nullptr;
LegalMessageView* legal_message_view_ = nullptr; LegalMessageView* legal_message_view_ = nullptr;
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h" #include "ui/base/models/simple_menu_model.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/font_list.h" #include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/insets.h"
...@@ -128,9 +129,9 @@ std::unique_ptr<views::View> CreateSiteSettingsLink( ...@@ -128,9 +129,9 @@ std::unique_ptr<views::View> CreateSiteSettingsLink(
} // namespace } // namespace
// |BubbleHeaderView| is the UI element (view) that represents the header of the // BubbleHeaderView is the UI element (view) that represents the header of a
// |PageInfoBubbleView|. The header shows the status of the site's // PageInfoBubbleView. The header shows the status of the site's identity check
// identity check and the name of the site's identity. // and the name of the site's identity.
class BubbleHeaderView : public views::View, public views::StyledLabelListener { class BubbleHeaderView : public views::View, public views::StyledLabelListener {
public: public:
BubbleHeaderView(PageInfoBubbleView* bubble, int side_margin); BubbleHeaderView(PageInfoBubbleView* bubble, int side_margin);
...@@ -237,7 +238,7 @@ BubbleHeaderView::BubbleHeaderView(PageInfoBubbleView* bubble, int side_margin) ...@@ -237,7 +238,7 @@ BubbleHeaderView::BubbleHeaderView(PageInfoBubbleView* bubble, int side_margin)
views::GridLayout::FILL, views::GridLayout::LEADING); views::GridLayout::FILL, views::GridLayout::LEADING);
} }
BubbleHeaderView::~BubbleHeaderView() {} BubbleHeaderView::~BubbleHeaderView() = default;
void BubbleHeaderView::StyledLabelLinkClicked(views::StyledLabel* label, void BubbleHeaderView::StyledLabelLinkClicked(views::StyledLabel* label,
const gfx::Range& range, const gfx::Range& range,
...@@ -472,8 +473,9 @@ void PageInfoBubbleView::SecurityDetailsClicked(int event_flags) { ...@@ -472,8 +473,9 @@ void PageInfoBubbleView::SecurityDetailsClicked(int event_flags) {
} else { } else {
web_contents()->OpenURL(content::OpenURLParams( web_contents()->OpenURL(content::OpenURLParams(
GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(),
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, ui::DispositionFromEventFlags(
false)); event_flags, WindowOpenDisposition::NEW_FOREGROUND_TAB),
ui::PAGE_TRANSITION_LINK, false));
presenter_->RecordPageInfoAction( presenter_->RecordPageInfoAction(
PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED);
} }
......
...@@ -260,6 +260,10 @@ void SafetyTipPageInfoBubbleView::StyledLabelLinkClicked( ...@@ -260,6 +260,10 @@ void SafetyTipPageInfoBubbleView::StyledLabelLinkClicked(
views::StyledLabel* label, views::StyledLabel* label,
const gfx::Range& range, const gfx::Range& range,
int event_flags) { int event_flags) {
OpenHelpCenter();
}
void SafetyTipPageInfoBubbleView::OpenHelpCenter() {
action_taken_ = SafetyTipInteraction::kLearnMore; action_taken_ = SafetyTipInteraction::kLearnMore;
OpenHelpCenterFromSafetyTip(web_contents()); OpenHelpCenterFromSafetyTip(web_contents());
} }
......
...@@ -62,7 +62,8 @@ class SafetyTipPageInfoBubbleView : public PageInfoBubbleViewBase, ...@@ -62,7 +62,8 @@ class SafetyTipPageInfoBubbleView : public PageInfoBubbleViewBase,
private: private:
friend class SafetyTipPageInfoBubbleViewBrowserTest; friend class SafetyTipPageInfoBubbleViewBrowserTest;
views::StyledLabel* GetLearnMoreLinkForTesting() { return info_button_; } void OpenHelpCenter();
views::Button* GetLeaveButtonForTesting() { return leave_button_; } views::Button* GetLeaveButtonForTesting() { return leave_button_; }
const security_state::SafetyTipStatus safety_tip_status_; const security_state::SafetyTipStatus safety_tip_status_;
......
...@@ -308,8 +308,7 @@ class SafetyTipPageInfoBubbleViewBrowserTest ...@@ -308,8 +308,7 @@ class SafetyTipPageInfoBubbleViewBrowserTest
// This class is a friend to SafetyTipPageInfoBubbleView. // This class is a friend to SafetyTipPageInfoBubbleView.
auto* bubble = static_cast<SafetyTipPageInfoBubbleView*>( auto* bubble = static_cast<SafetyTipPageInfoBubbleView*>(
PageInfoBubbleViewBase::GetPageInfoBubbleForTesting()); PageInfoBubbleViewBase::GetPageInfoBubbleForTesting());
bubble->StyledLabelLinkClicked(bubble->GetLearnMoreLinkForTesting(), bubble->OpenHelpCenter();
gfx::Range(), 0);
} }
void CloseWarningLeaveSite(Browser* browser) { void CloseWarningLeaveSite(Browser* browser) {
......
...@@ -575,13 +575,10 @@ void PaymentSheetViewController::StyledLabelLinkClicked( ...@@ -575,13 +575,10 @@ void PaymentSheetViewController::StyledLabelLinkClicked(
views::StyledLabel* label, views::StyledLabel* label,
const gfx::Range& range, const gfx::Range& range,
int event_flags) { int event_flags) {
if (!dialog()->IsInteractive()) if (dialog()->IsInteractive()) {
return; chrome::ShowSettingsSubPageForProfile(dialog()->GetProfile(),
chrome::kPaymentsSubPage);
// The only thing that can trigger this is the user clicking on the "settings" }
// link in the data attribution text.
chrome::ShowSettingsSubPageForProfile(dialog()->GetProfile(),
chrome::kPaymentsSubPage);
} }
void PaymentSheetViewController::UpdatePayButtonState(bool enabled) { void PaymentSheetViewController::UpdatePayButtonState(bool enabled) {
......
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
#include "components/payments/content/payment_request_state.h" #include "components/payments/content/payment_request_state.h"
#include "ui/views/controls/styled_label_listener.h" #include "ui/views/controls/styled_label_listener.h"
namespace views {
class StyledLabel;
}
namespace payments { namespace payments {
class PaymentRequestDialogView; class PaymentRequestDialogView;
......
...@@ -123,7 +123,9 @@ void PromptForScanningModalDialog::StyledLabelLinkClicked( ...@@ -123,7 +123,9 @@ void PromptForScanningModalDialog::StyledLabelLinkClicked(
int event_flags) { int event_flags) {
web_contents_->OpenURL(content::OpenURLParams( web_contents_->OpenURL(content::OpenURLParams(
GURL(chrome::kAdvancedProtectionDownloadLearnMoreURL), GURL(chrome::kAdvancedProtectionDownloadLearnMoreURL),
content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, content::Referrer(),
ui::DispositionFromEventFlags(event_flags,
WindowOpenDisposition::NEW_FOREGROUND_TAB),
ui::PAGE_TRANSITION_LINK, /*is_renderer_initiated=*/false)); ui::PAGE_TRANSITION_LINK, /*is_renderer_initiated=*/false));
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "ui/base/buildflags.h" #include "ui/base/buildflags.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/window_open_disposition.h"
#include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/label_button_border.h" #include "ui/views/controls/button/label_button_border.h"
#include "ui/views/controls/button/menu_button.h" #include "ui/views/controls/button/menu_button.h"
...@@ -294,7 +295,9 @@ void SessionCrashedBubbleView::StyledLabelLinkClicked(views::StyledLabel* label, ...@@ -294,7 +295,9 @@ void SessionCrashedBubbleView::StyledLabelLinkClicked(views::StyledLabel* label,
int event_flags) { int event_flags) {
browser_->OpenURL(content::OpenURLParams( browser_->OpenURL(content::OpenURLParams(
GURL("https://support.google.com/chrome/answer/96817"), GURL("https://support.google.com/chrome/answer/96817"),
content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, content::Referrer(),
ui::DispositionFromEventFlags(event_flags,
WindowOpenDisposition::NEW_FOREGROUND_TAB),
ui::PAGE_TRANSITION_LINK, false)); ui::PAGE_TRANSITION_LINK, false));
RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_HELP); RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_HELP);
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/events/event_constants.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/strings/grit/ui_strings.h" #include "ui/strings/grit/ui_strings.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
...@@ -180,8 +181,7 @@ TEST_F(SharingDialogViewTest, HelpTextClickedEmpty) { ...@@ -180,8 +181,7 @@ TEST_F(SharingDialogViewTest, HelpTextClickedEmpty) {
auto dialog_data = CreateDialogData(/*devices=*/0, /*apps=*/0); auto dialog_data = CreateDialogData(/*devices=*/0, /*apps=*/0);
auto dialog = CreateDialogView(std::move(dialog_data)); auto dialog = CreateDialogView(std::move(dialog_data));
dialog->StyledLabelLinkClicked(/*label=*/nullptr, /*range=*/{}, dialog->StyledLabelLinkClicked(nullptr, gfx::Range(), ui::EF_NONE);
/*event_flags=*/0);
} }
TEST_F(SharingDialogViewTest, HelpTextClickedOnlyApps) { TEST_F(SharingDialogViewTest, HelpTextClickedOnlyApps) {
...@@ -191,8 +191,7 @@ TEST_F(SharingDialogViewTest, HelpTextClickedOnlyApps) { ...@@ -191,8 +191,7 @@ TEST_F(SharingDialogViewTest, HelpTextClickedOnlyApps) {
auto dialog_data = CreateDialogData(/*devices=*/0, /*apps=*/1); auto dialog_data = CreateDialogData(/*devices=*/0, /*apps=*/1);
auto dialog = CreateDialogView(std::move(dialog_data)); auto dialog = CreateDialogView(std::move(dialog_data));
dialog->StyledLabelLinkClicked(/*label=*/nullptr, /*range=*/{}, dialog->StyledLabelLinkClicked(nullptr, gfx::Range(), ui::EF_NONE);
/*event_flags=*/0);
} }
TEST_F(SharingDialogViewTest, ThemeChangedEmptyList) { TEST_F(SharingDialogViewTest, ThemeChangedEmptyList) {
......
...@@ -33,6 +33,7 @@ class LegalMessageLine { ...@@ -33,6 +33,7 @@ class LegalMessageLine {
gfx::Range range; gfx::Range range;
GURL url; GURL url;
}; };
using Links = std::vector<Link>;
LegalMessageLine(); LegalMessageLine();
LegalMessageLine(const LegalMessageLine& other); LegalMessageLine(const LegalMessageLine& other);
...@@ -75,7 +76,7 @@ class LegalMessageLine { ...@@ -75,7 +76,7 @@ class LegalMessageLine {
bool escape_apostrophes = false); bool escape_apostrophes = false);
const base::string16& text() const { return text_; } const base::string16& text() const { return text_; }
const std::vector<Link>& links() const { return links_; } const Links& links() const { return links_; }
private: private:
friend class TestLegalMessageLine; friend class TestLegalMessageLine;
...@@ -83,7 +84,7 @@ class LegalMessageLine { ...@@ -83,7 +84,7 @@ class LegalMessageLine {
bool ParseLine(const base::Value& line, bool escape_apostrophes); bool ParseLine(const base::Value& line, bool escape_apostrophes);
base::string16 text_; base::string16 text_;
std::vector<Link> links_; Links links_;
}; };
} // namespace autofill } // namespace autofill
......
...@@ -21,8 +21,7 @@ class TestLegalMessageLine : public LegalMessageLine { ...@@ -21,8 +21,7 @@ class TestLegalMessageLine : public LegalMessageLine {
TestLegalMessageLine(const std::string& ascii_text) { set_text(ascii_text); } TestLegalMessageLine(const std::string& ascii_text) { set_text(ascii_text); }
TestLegalMessageLine(const std::string& ascii_text, TestLegalMessageLine(const std::string& ascii_text, const Links& links) {
const std::vector<Link>& links) {
set_text(ascii_text); set_text(ascii_text);
set_links(links); set_links(links);
} }
...@@ -33,7 +32,7 @@ class TestLegalMessageLine : public LegalMessageLine { ...@@ -33,7 +32,7 @@ class TestLegalMessageLine : public LegalMessageLine {
text_ = base::ASCIIToUTF16(ascii_text); text_ = base::ASCIIToUTF16(ascii_text);
} }
void set_links(const std::vector<Link>& links) { links_ = links; } void set_links(const Links& links) { links_ = links; }
private: private:
DISALLOW_COPY_AND_ASSIGN(TestLegalMessageLine); DISALLOW_COPY_AND_ASSIGN(TestLegalMessageLine);
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "ui/gfx/font_list.h" #include "ui/gfx/font_list.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/controls/link.h" #include "ui/views/controls/link.h"
#include "ui/views/controls/styled_label_listener.h"
#include "ui/views/style/typography.h" #include "ui/views/style/typography.h"
#include "ui/views/test/test_layout_provider.h" #include "ui/views/test/test_layout_provider.h"
#include "ui/views/test/test_views.h" #include "ui/views/test/test_views.h"
......
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