• Hitoshi Yoshida's avatar
    Revert "Set initial focus on session restore" · 24dc1eb6
    Hitoshi Yoshida authored
    This reverts commit 414b62b0.
    
    Reason for revert: Regresses a test on Mac.
    
    Bug: 1110239
    
    Original change's description:
    > Set initial focus on session restore
    > 
    > Issue:
    > - When On startup setting is set to "Continue where you left off",
    > the initial focus is not set after launching the browser.
    > - Users have to press Tab to focus the window.
    > - This affects users who rely on screen readers since the window
    > information is not announced on launch (on UIA mode).
    > 
    > More context:
    > - The line calling SetInitialFocus was previously in the code but got
    > removed after a startup focus refactor:
    > https://chromium-review.googlesource.com/c/chromium/src/+/1313728
    > - The refactor added the call to RestoreFocus on
    > BrowserView::OnWidgetActivationChanged if the property
    > restore_focus_on_activation_ is set to True. This property gets set
    > during BrowserView::Show, but only in the case of session restore,
    > Show gets called after OnWidgetActivationChanged so RestoreFocus is
    > never called.
    > - The inverted call stack on session restore is because AddRestoredTab
    > on browser_tabrestore calls Activate before showing the window.
    > 
    > Fix:
    > - Similar to what we currently have for MacOS, only call Activate
    > in AddRestoredTab if it is not |from_session_restore|. This way Show
    > will be called before Activate and thus focus will be set as
    > expected.
    > - This change is only made on Windows due to a couple of reasons
    > 1) crbug.com/1102685 is only present on this platform.
    > 2) Making this change on Linux would re-introduce crbug.com/1019048.
    > 
    > Bug: 1102685
    > Change-Id: I6e62ebad7693eb5d908770364ba7c8d755ccaa70
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2284382
    > Reviewed-by: Scott Violet <sky@chromium.org>
    > Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
    > Commit-Queue: Maria Villarreal <mavill@microsoft.com>
    > Cr-Commit-Position: refs/heads/master@{#791950}
    
    TBR=xiyuan@chromium.org,sky@chromium.org,fdoray@chromium.org,mavill@microsoft.com
    
    Change-Id: I258891124447cb71b163b35452b84b999857cf96
    No-Presubmit: true
    No-Tree-Checks: true
    No-Try: true
    Bug: 1102685
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2322266Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
    Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#792176}
    24dc1eb6
browser_tabrestore.cc 9.77 KB