Commit dc5e8ec9 authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Specify more context and style info for the label in the critical and outdated update dialogs.

Bug: 651648
Change-Id: Ice5dac45a04acfd7e69232e5114c8cc17c302e71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1773321
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690783}
parent ac90937b
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/upgrade_detector/upgrade_detector.h" #include "chrome/browser/upgrade_detector/upgrade_detector.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
...@@ -23,6 +24,7 @@ ...@@ -23,6 +24,7 @@
#include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/style/typography.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
using base::UserMetricsAction; using base::UserMetricsAction;
...@@ -125,15 +127,16 @@ void CriticalNotificationBubbleView::Init() { ...@@ -125,15 +127,16 @@ void CriticalNotificationBubbleView::Init() {
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
views::Label* message = new views::Label(); auto message = std::make_unique<views::Label>(
l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_TEXT),
views::style::CONTEXT_MESSAGE_BOX_BODY_TEXT, STYLE_SECONDARY);
message->SetMultiLine(true); message->SetMultiLine(true);
message->SetHorizontalAlignment(gfx::ALIGN_LEFT); message->SetHorizontalAlignment(gfx::ALIGN_LEFT);
message->SetText(l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_TEXT));
message->SizeToFit( message->SizeToFit(
ChromeLayoutProvider::Get()->GetDistanceMetric( ChromeLayoutProvider::Get()->GetDistanceMetric(
ChromeDistanceMetric::DISTANCE_BUBBLE_PREFERRED_WIDTH) - ChromeDistanceMetric::DISTANCE_BUBBLE_PREFERRED_WIDTH) -
margins().width()); margins().width());
AddChildView(message); AddChildView(std::move(message));
refresh_timer_.Start(FROM_HERE, refresh_timer_.Start(FROM_HERE,
base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery),
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/upgrade_detector/upgrade_detector.h" #include "chrome/browser/upgrade_detector/upgrade_detector.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/style/typography.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -152,15 +154,16 @@ base::string16 OutdatedUpgradeBubbleView::GetDialogButtonLabel( ...@@ -152,15 +154,16 @@ base::string16 OutdatedUpgradeBubbleView::GetDialogButtonLabel(
void OutdatedUpgradeBubbleView::Init() { void OutdatedUpgradeBubbleView::Init() {
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
views::Label* text_label = auto text_label = std::make_unique<views::Label>(
new views::Label(l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_TEXT)); l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_TEXT),
views::style::CONTEXT_MESSAGE_BOX_BODY_TEXT, STYLE_SECONDARY);
text_label->SetMultiLine(true); text_label->SetMultiLine(true);
text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
text_label->SizeToFit( text_label->SizeToFit(
ChromeLayoutProvider::Get()->GetDistanceMetric( ChromeLayoutProvider::Get()->GetDistanceMetric(
ChromeDistanceMetric::DISTANCE_BUBBLE_PREFERRED_WIDTH) - ChromeDistanceMetric::DISTANCE_BUBBLE_PREFERRED_WIDTH) -
margins().width()); margins().width());
AddChildView(text_label); AddChildView(std::move(text_label));
} }
OutdatedUpgradeBubbleView::OutdatedUpgradeBubbleView( OutdatedUpgradeBubbleView::OutdatedUpgradeBubbleView(
......
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