• tapted's avatar
    Fix SpeechUIModel lifetime issue in Chrome's AppListViewDelegate when switching profiles · 966607ad
    tapted authored
    The AppListView observes the SpeechUIModel directly, so SpeechUIModel
    must outlive profile changes within Chrome's AppListViewDelegate.
    Profile changes only recreate the app_list::ContentView and subviews,
    which updates app_list::AppListModel observers, but not
    app_list::SpeechUIModel observers.
    
    This comes up when switching profiles in the desktop app list.
    
    To fix, this change gives SpeechUIModel a default constructor to
    simplify setting the initial speech recognition state, which needs the
    profile. Then, decouples the lifetime of the SpeechUIModel from the
    Profile in Chrome's AppListViewDelegate.
    
    BUG=405827
    TBR=jamescook@chromium.org
    
    Review URL: https://codereview.chromium.org/550883002
    
    Cr-Commit-Position: refs/heads/master@{#293878}
    966607ad
speech_ui_model.h 1.8 KB