Commit bbc3cf34 authored by Andre Le's avatar Andre Le Committed by Commit Bot

[CrOS PhoneHub] Adjust bubble size when browser tabs changed in task

continuation.

When browser tabs changed and the bubble is not closed, the bubble's
size need to be re-adjusted in TaskContinuationView and
PhoneConnectedView.

BUG=1106937,1126208

Change-Id: I110b8cd25ce45764b0072f99c6ec32e1bf00444f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438753Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Commit-Queue: Andre Le <leandre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812206}
parent 4c1d287c
...@@ -62,6 +62,16 @@ PhoneConnectedView::PhoneConnectedView( ...@@ -62,6 +62,16 @@ PhoneConnectedView::PhoneConnectedView(
PhoneConnectedView::~PhoneConnectedView() = default; PhoneConnectedView::~PhoneConnectedView() = default;
void PhoneConnectedView::ChildPreferredSizeChanged(View* child) {
// Resize the bubble when the child change its size.
PreferredSizeChanged();
}
void PhoneConnectedView::ChildVisibilityChanged(View* child) {
// Resize the bubble when the child change its visibility.
PreferredSizeChanged();
}
const char* PhoneConnectedView::GetClassName() const { const char* PhoneConnectedView::GetClassName() const {
return "PhoneConnectedView"; return "PhoneConnectedView";
} }
......
...@@ -27,6 +27,8 @@ class PhoneConnectedView : public views::View { ...@@ -27,6 +27,8 @@ class PhoneConnectedView : public views::View {
~PhoneConnectedView() override; ~PhoneConnectedView() override;
// views::View: // views::View:
void ChildPreferredSizeChanged(View* child) override;
void ChildVisibilityChanged(View* child) override;
const char* GetClassName() const override; const char* GetClassName() const override;
private: private:
......
...@@ -142,6 +142,8 @@ void TaskContinuationView::TaskChipsView::CalculateIdealBounds() { ...@@ -142,6 +142,8 @@ void TaskContinuationView::TaskChipsView::CalculateIdealBounds() {
} }
void TaskContinuationView::Update() { void TaskContinuationView::Update() {
chips_view_->Reset();
if (!phone_model_->browser_tabs_model()) { if (!phone_model_->browser_tabs_model()) {
SetVisible(false); SetVisible(false);
return; return;
...@@ -156,12 +158,12 @@ void TaskContinuationView::Update() { ...@@ -156,12 +158,12 @@ void TaskContinuationView::Update() {
return; return;
} }
chips_view_->Reset();
for (const BrowserTabsModel::BrowserTabMetadata& metadata : for (const BrowserTabsModel::BrowserTabMetadata& metadata :
browser_tabs.most_recent_tabs()) { browser_tabs.most_recent_tabs()) {
chips_view_->AddTaskChip(new ContinueBrowsingChip(metadata)); chips_view_->AddTaskChip(new ContinueBrowsingChip(metadata));
} }
PreferredSizeChanged();
SetVisible(true); SetVisible(true);
} }
......
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