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

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

Issue 2694893002: Integrate SMS service with Desktop iOS promotion (Closed)
Patch Set: passwords and histogram changes Created 3 years, 10 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_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..94e19d01876f2efde74e536275ea8d98a7c4325c 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,14 +5,15 @@
#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"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.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 +31,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->SetPromotion(this);
+ int bubbleWidth =
+ ::GetDesiredBubbleMaxWidth(promotion_controller_->GetEntryPoint());
views::GridLayout* layout = new views::GridLayout(this);
layout->set_minimum_size(gfx::Size(bubbleWidth, 0));
SetLayoutManager(layout);
@@ -43,6 +46,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 +59,31 @@ 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()));
label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
layout->StartRow(0, kLabelColumnSet);
layout->AddView(label);
+ layout->StartRow(0, kLabelColumnSet);
+ recovery_phone_label_ = new views::Label(
+ base::UTF8ToUTF16(promotion_controller_->GetUsersRecoveryPhoneNumber()));
+ ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
+ recovery_phone_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ recovery_phone_label_->SetFontList(
+ rb->GetFontList(ui::ResourceBundle::BoldFont));
+ recovery_phone_label_->SetEnabledColor(SK_ColorGRAY);
+ 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 +95,10 @@ void DesktopIOSPromotionView::ButtonPressed(views::Button* sender,
}
GetWidget()->Close();
}
+
+void DesktopIOSPromotionView::UpdateRecoveryPhoneLabel() {
+ if (recovery_phone_label_) {
+ recovery_phone_label_->SetText(base::UTF8ToUTF16(
+ promotion_controller_->GetUsersRecoveryPhoneNumber()));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698