Commit 74765b49 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

Don't send dismiss histogram if the user logged in

On iPad, the user can show the bookmarks with the sign-in promo and open
the settings. If they sign in with the settings, then the sign-in promo
will be removed from the bookmarks. The mediator from the bookmarks
should not send the dismiss histogram.

To avoid this problem, the sign-in promo view mediator needs to check
if the user is logged in before sending the dismiss histogram.

Bug: 742514
Change-Id: Id5c189e68a06e82874ef487155831593911a9ef4
Reviewed-on: https://chromium-review.googlesource.com/567508
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487061}
parent a64f0d67
......@@ -13,6 +13,8 @@
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_browser_provider_observer_bridge.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/signin/authentication_service.h"
#include "ios/chrome/browser/signin/authentication_service_factory.h"
#include "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
#import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h"
#import "ios/chrome/browser/ui/authentication/signin_promo_view_consumer.h"
......@@ -276,6 +278,13 @@ void RecordSigninNewAccountUserActionForAccessPoint(
// counted as dismissed (even if the sign-in has been canceled).
if (!_displayedCountPreferenceKey || !wasUnused)
return;
// If the sign-in view is removed when the user is authenticated, then the
// sign-in has been done by another view, and this mediator cannot be counted
// as being dismissed.
AuthenticationService* authService =
AuthenticationServiceFactory::GetForBrowserState(_browserState);
if (authService->IsAuthenticated())
return;
PrefService* prefs = _browserState->GetPrefs();
int displayedCount = prefs->GetInteger(_displayedCountPreferenceKey);
switch (_histograms) {
......
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