Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2667)

Unified Diff: chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc

Issue 2815303004: Update the Windows iOS promotion to have the same width as the bubble that appears before it. (Closed)
Patch Set: Same width bubble Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc
diff --git a/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc b/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc
index 47e050d0da5e8092c5ccfadd0c9818fd998035f0..6a00277e56f652e2105d29d4d9adc91027696426 100644
--- a/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc
+++ b/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.cc
@@ -25,9 +25,7 @@ DesktopIOSPromotionBubbleView::DesktopIOSPromotionBubbleView(
base::MakeUnique<DesktopIOSPromotionController>(profile,
this,
entry_point)) {
- int bubble_width = ManagePasswordsBubbleView::kDesiredBubbleWidth;
views::GridLayout* layout = new views::GridLayout(this);
- layout->set_minimum_size(gfx::Size(bubble_width, 0));
layout->SetInsets(
0,
LayoutDelegate::Get()->GetMetric(
@@ -45,7 +43,7 @@ DesktopIOSPromotionBubbleView::DesktopIOSPromotionBubbleView(
constexpr int kLabelColumnSet = 1;
views::ColumnSet* column_set = layout->AddColumnSet(kLabelColumnSet);
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0,
- views::GridLayout::FIXED, bubble_width, 0);
+ views::GridLayout::USE_PREF, 0, 0);
constexpr int kDoubleButtonColumnSet = 2;
column_set = layout->AddColumnSet(kDoubleButtonColumnSet);
column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
@@ -57,6 +55,8 @@ DesktopIOSPromotionBubbleView::DesktopIOSPromotionBubbleView(
0, views::GridLayout::USE_PREF, 0, 0);
promotion_text_label_->SetEnabledColor(SK_ColorGRAY);
promotion_text_label_->SetMultiLine(true);
+ promotion_text_label_->SizeToFit(
+ desktop_ios_promotion::GetPromoBubbleTextLabelWidth(entry_point));
promotion_text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
layout->StartRow(0, kLabelColumnSet);
layout->AddView(promotion_text_label_);
@@ -83,11 +83,19 @@ void DesktopIOSPromotionBubbleView::ButtonPressed(views::Button* sender,
GetWidget()->Close();
}
+void DesktopIOSPromotionBubbleView::UpdateBubbleHeight(gfx::Rect old_bounds) {
+ old_bounds.set_height(
sky 2017/04/17 17:21:55 Can't this code call GetBubbleBounds() directly ra
mrefaat 2017/04/17 19:10:49 Bubble bounds may change on layout, so i need to k
sky 2017/04/17 22:46:12 Good point. I think you want GetWindowBoundsInScre
mrefaat 2017/04/17 23:00:27 Not sure what is the difference, i think getbubble
+ GetWidget()->GetRootView()->GetHeightForWidth(old_bounds.width()));
+ GetWidget()->SetBounds(old_bounds);
+ GetWidget()->GetRootView()->Layout();
sky 2017/04/17 17:21:55 I wouldn't expect you to need an explicit layout h
mrefaat 2017/04/17 19:10:49 I removed it it didn't affect the results, Does th
+}
+
void DesktopIOSPromotionBubbleView::UpdateRecoveryPhoneLabel() {
std::string number = promotion_controller_->GetUsersRecoveryPhoneNumber();
if (!number.empty()) {
promotion_text_label_->SetText(desktop_ios_promotion::GetPromoText(
promotion_controller_->entry_point(), number));
- SizeToPreferredSize();
+ Layout();
+ UpdateBubbleHeight(GetWidget()->GetRootView()->GetBoundsInScreen());
}
}

Powered by Google App Engine
This is Rietveld 408576698