• Cooper Knaak's avatar
    [iOS] Notify FeatureEngagementTracker of Chrome Opened Event · 82a2c848
    Cooper Knaak authored
    This CL sends a notification to the FeatureEngagementTracker when
    the user opens Chrome both from a cold start and a warm start.
    
    Warm starts include backgrounding the app and reopening it, launching
    another app from Chrome and returning to it, and locking then unlocking
    the screen when Chrome is in the foreground.
    
    -[AppState applicationWillEnterForeground: ... ] handles the warm
    start event because it is called whenever the app is taken out of
    the background (except on the initial launch, which is a cold start).
    
    The cold start event must occur in the startup flow, a complex process,
    so finding a good place for the notification is tricky. It needs to
    be called exactly once, and it needs a ChromeBrowserState object.
    -[MainController startUpBrowserForegroundInitialization] was chosen
    for a couple reasons.
     * It's called as part of the startup flow (necessary to make the
       chrome launched event accurate).
     * It's only called once. startUpBrowserToStage, which calls
       startUpBrowserForegroundInitialization, keeps track of what stage
       of initialization the app is in and makes sure it is not called
       twice.
     * This is where the ChromeBrowserState object is initialized. The
       FeatureEngagementTrackerFactory uses ChromeBrowserState to store
       and retrieve the FeatureEngagementTracker.
    
    Locking then unlocking the screen with Chrome in the foreground is
    considered a warm start because applicationWillEnterForeground is
    called. Although this is not necessarily desired behavior, there's no
    way to determine whether the app is returning from the lock screen.
    This slightly increases the potential number of times the Chrome
    Opened Event is fired, so in-product help promotions relying on this
    event should increase the number of times this event must have fired
    to compensate.
    
    R=edchin@chromium.org, gchatz@chromium.org
    
    Bug: 738164
    Change-Id: I656297a800600672931c785fcac0fd6dcd4996aa
    Reviewed-on: https://chromium-review.googlesource.com/558666
    Commit-Queue: Cooper Knaak <cooperknaak@google.com>
    Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
    Reviewed-by: default avatarMark Cogan <marq@chromium.org>
    Reviewed-by: default avatarEd Chin <edchin@chromium.org>
    Reviewed-by: default avatarGregory Chatzinoff <gchatz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#486644}
    82a2c848
DEPS 1.29 KB