Chromium Code Reviews| Index: chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.cc |
| diff --git a/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.cc b/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.cc |
| index e95ae4ef36e296c4b09917c1166ef8ff6adb139c..9cdb7d594eecc2954679c9dfe50a573b36ff92e1 100644 |
| --- a/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.cc |
| +++ b/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.cc |
| @@ -28,9 +28,13 @@ DesktopIOSPromotionController::DesktopIOSPromotionController( |
| dismissal_reason_( |
| desktop_ios_promotion::PromotionDismissalReason::FOCUS_LOST), |
| weak_ptr_factory_(this) { |
| - sms_service_->QueryPhoneNumber( |
| - base::Bind(&DesktopIOSPromotionController::OnGotPhoneNumber, |
| - weak_ptr_factory_.GetWeakPtr())); |
| + if (entry_point_ != |
| + desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_FOOTNOTE) { |
| + // Footnote promotion doesn't have a phone number. |
| + sms_service_->QueryPhoneNumber( |
| + base::Bind(&DesktopIOSPromotionController::OnGotPhoneNumber, |
| + weak_ptr_factory_.GetWeakPtr())); |
| + } |
| } |
| DesktopIOSPromotionController::~DesktopIOSPromotionController() { |
| @@ -51,6 +55,19 @@ void DesktopIOSPromotionController::OnSendSMSClicked() { |
| } |
| void DesktopIOSPromotionController::OnPromotionShown() { |
| + // Update histograms. |
|
sky
2017/05/17 16:00:41
Remove this comment as it just documents what the
mrefaat
2017/05/17 19:44:56
Done.
|
| + UMA_HISTOGRAM_ENUMERATION( |
| + "DesktopIOSPromotion.ImpressionFromEntryPoint", |
| + static_cast<int>(entry_point_), |
| + static_cast<int>( |
| + desktop_ios_promotion::PromotionEntryPoint::ENTRY_POINT_MAX_VALUE)); |
| + |
| + if (entry_point_ == |
| + desktop_ios_promotion::PromotionEntryPoint::FOOTNOTE_FOLLOWUP_BUBBLE) { |
| + // We don't want to update sync with the impression of this entrypoint. |
| + return; |
| + } |
| + |
| // update the impressions count. |
| PrefService* local_state = g_browser_process->local_state(); |
| int impressions = local_state->GetInteger( |
| @@ -85,22 +102,23 @@ void DesktopIOSPromotionController::OnPromotionShown() { |
| features::kDesktopIOSPromotion, "promo_variation_id", 0); |
| if (variation_id) |
| profile_prefs_->SetInteger(prefs::kIOSPromotionVariationId, variation_id); |
| +} |
| - // Update histograms. |
| - UMA_HISTOGRAM_ENUMERATION( |
| - "DesktopIOSPromotion.ImpressionFromEntryPoint", |
| - static_cast<int>(entry_point_), |
| - static_cast<int>( |
| - desktop_ios_promotion::PromotionEntryPoint::ENTRY_POINT_MAX_VALUE)); |
| +void DesktopIOSPromotionController::OnLearnMoreLinkClicked() { |
| + dismissal_reason_ = |
| + desktop_ios_promotion::PromotionDismissalReason::LEARN_MORE; |
| } |
| void DesktopIOSPromotionController::OnNoThanksClicked() { |
| - PrefService* local_state = g_browser_process->local_state(); |
| - local_state->SetBoolean( |
| - desktop_ios_promotion::kEntryPointLocalPrefs |
| - [static_cast<int>(entry_point_)][static_cast<int>( |
| - desktop_ios_promotion::EntryPointLocalPrefType::DISMISSED)], |
| - true); |
| + if (entry_point_ != |
| + desktop_ios_promotion::PromotionEntryPoint::FOOTNOTE_FOLLOWUP_BUBBLE) { |
| + PrefService* local_state = g_browser_process->local_state(); |
| + local_state->SetBoolean( |
| + desktop_ios_promotion::kEntryPointLocalPrefs |
| + [static_cast<int>(entry_point_)][static_cast<int>( |
| + desktop_ios_promotion::EntryPointLocalPrefType::DISMISSED)], |
| + true); |
| + } |
| dismissal_reason_ = |
| desktop_ios_promotion::PromotionDismissalReason::NO_THANKS; |
| } |
| @@ -113,6 +131,7 @@ void DesktopIOSPromotionController::OnGotPhoneNumber( |
| SMSService::Request* request, |
| bool success, |
| const std::string& number) { |
| + DCHECK(promotion_view_); |
| if (success) { |
| recovery_number_ = desktop_ios_promotion::FormatPhoneNumber(number); |
| promotion_view_->UpdateRecoveryPhoneLabel(); |