Index: chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_view.cc |
diff --git a/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_view.cc b/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_view.cc |
index 2407284eb936ca3413ea1b106eedaa93982b3ce4..680723bc5adf1f8bd5dd41d8643fcf526a18de2f 100644 |
--- a/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_view.cc |
+++ b/chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_view.cc |
@@ -5,6 +5,7 @@ |
#include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_view.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h" |
#include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
@@ -12,7 +13,6 @@ |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/views/controls/button/button.h" |
#include "ui/views/controls/button/md_text_button.h" |
-#include "ui/views/controls/link.h" |
#include "ui/views/layout/grid_layout.h" |
#include "ui/views/layout/layout_constants.h" |
@@ -30,9 +30,11 @@ int GetDesiredBubbleMaxWidth( |
} // namespace |
DesktopIOSPromotionView::DesktopIOSPromotionView( |
- desktop_ios_promotion::PromotionEntryPoint entry_point) { |
- promotion_controller_ = new DesktopIOSPromotionController(); |
- int bubbleWidth = ::GetDesiredBubbleMaxWidth(entry_point); |
+ DesktopIOSPromotionController* controller) |
+ : promotion_controller_(controller) { |
+ controller->SetPromotionView(this); |
+ int bubbleWidth = |
sky
2017/02/17 19:06:26
bubble_width
mrefaat
2017/02/17 21:53:13
Done.
|
+ ::GetDesiredBubbleMaxWidth(promotion_controller_->GetEntryPoint()); |
views::GridLayout* layout = new views::GridLayout(this); |
layout->set_minimum_size(gfx::Size(bubbleWidth, 0)); |
SetLayoutManager(layout); |
@@ -43,6 +45,7 @@ DesktopIOSPromotionView::DesktopIOSPromotionView( |
constexpr int kLabelColumnSet = 1; |
views::ColumnSet* column_set = layout->AddColumnSet(kLabelColumnSet); |
+ column_set->AddPaddingColumn(0, views::kPanelHorizMargin); |
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
views::GridLayout::FIXED, bubbleWidth, 0); |
@@ -55,19 +58,28 @@ DesktopIOSPromotionView::DesktopIOSPromotionView( |
0, views::GridLayout::USE_PREF, 0, 0); |
views::Label* label = |
- new views::Label(desktop_ios_promotion::GetPromoBubbleText(entry_point)); |
+ new views::Label(desktop_ios_promotion::GetPromoBubbleText( |
+ promotion_controller_->GetEntryPoint())); |
+ VLOG(0) << base::UTF8ToUTF16( |
sky
2017/02/17 00:57:23
Remove this. If you really really want to log, use
mrefaat
2017/02/17 04:31:49
i had it for debugging - forgot to delete it. Than
|
+ promotion_controller_->GetUsersRecoveryPhoneNumber()); |
+ recovery_phone_label_ = new views::Label( |
+ base::UTF8ToUTF16(promotion_controller_->GetUsersRecoveryPhoneNumber())); |
label->SetMultiLine(true); |
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
layout->StartRow(0, kLabelColumnSet); |
layout->AddView(label); |
+ layout->StartRow(0, kLabelColumnSet); |
+ layout->AddView(recovery_phone_label_); |
layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
layout->StartRow(0, kDoubleButtonColumnSet); |
layout->AddView(send_sms_button_); |
layout->AddView(no_button_); |
- // TODO(crbug.com/676655): Log impression. |
+ promotion_controller_->OnPromotionShown(); |
} |
+DesktopIOSPromotionView::~DesktopIOSPromotionView() = default; |
+ |
void DesktopIOSPromotionView::ButtonPressed(views::Button* sender, |
const ui::Event& event) { |
if (sender == send_sms_button_) { |
@@ -79,3 +91,14 @@ void DesktopIOSPromotionView::ButtonPressed(views::Button* sender, |
} |
GetWidget()->Close(); |
} |
+ |
+void DesktopIOSPromotionView::UpdateRecoveryPhoneLabel() { |
+ if (recovery_phone_label_) |
sky
2017/02/17 00:57:23
{}
sky
2017/02/17 00:57:23
Under what circumstances could recovery_phone_labe
mrefaat
2017/02/17 04:31:49
If this was called before the constructor finishes
mrefaat
2017/02/17 04:31:49
Done.
sky
2017/02/17 19:06:25
Initialize recovery_phone_label_ in the member ini
mrefaat
2017/02/17 21:53:13
Done.
|
+ recovery_phone_label_->SetText(base::UTF8ToUTF16( |
+ promotion_controller_->GetUsersRecoveryPhoneNumber())); |
+} |
+ |
+DesktopIOSPromotion* CreateDesktopIOSPromotionView( |
+ DesktopIOSPromotionController* controller) { |
+ return new DesktopIOSPromotionView(controller); |
+} |