Commit 39c55f86 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Resize relaunch bubble on title changes

This fixes a bug where the browser window is left open and the dialog
title rolls over from "A Chromium update is available" to "A Chromium
update has been available for N days" which causes the title to wrap.

This is only a band-aid fix, calling BubbleFrameView::UpdateWindowTitle
should either push the width or height of the dialog to accommodate for
the longer title string.

Bug: chromium:869448
Change-Id: Ib78082e386111cb1da3835952fb9644051c6e572
Reviewed-on: https://chromium-review.googlesource.com/1173664
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583435}
parent 6544b8a5
......@@ -223,6 +223,9 @@ void RelaunchRecommendedBubbleView::ScheduleNextTitleRefresh() {
}
void RelaunchRecommendedBubbleView::OnTitleRefresh() {
GetBubbleFrameView()->UpdateWindowTitle();
GetWidget()->UpdateWindowTitle();
// This might update the length of the window title (for N days). Resize the
// bubble to match the new preferred size.
SizeToContents();
ScheduleNextTitleRefresh();
}
......@@ -23,13 +23,12 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/text_constants.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/border.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/style/typography.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/non_client_view.h"
// static
views::Widget* RelaunchRequiredDialogView::Show(
......@@ -271,14 +270,8 @@ void RelaunchRequiredDialogView::ScheduleNextTitleRefresh() {
}
void RelaunchRequiredDialogView::OnTitleRefresh() {
GetBubbleFrameView()->UpdateWindowTitle();
GetWidget()->UpdateWindowTitle();
if (!last_refresh_)
ScheduleNextTitleRefresh();
}
views::BubbleFrameView* RelaunchRequiredDialogView::GetBubbleFrameView() {
const views::NonClientView* view =
GetWidget() ? GetWidget()->non_client_view() : nullptr;
return view ? static_cast<views::BubbleFrameView*>(view->frame_view())
: nullptr;
}
......@@ -13,7 +13,6 @@
class Browser;
namespace views {
class BubbleFrameView;
class Label;
class Widget;
} // namespace views
......@@ -76,10 +75,6 @@ class RelaunchRequiredDialogView : views::DialogDelegateView {
// Invoked when the timer fires to refresh the title text.
void OnTitleRefresh();
// Returns the containing widget's NonClientView's FrameView as a
// BubbleFrameView.
views::BubbleFrameView* GetBubbleFrameView();
// The time at which Chrome will be forcefully relaunched.
base::TimeTicks relaunch_deadline_;
......
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