• sangwoo.ko's avatar
    Use TabStripModelObserver's new API in BrowserView · 40e8e763
    sangwoo.ko authored
    Replace old API with new API. This CL is a refactor and has no
    intended behavior change.
    
    In the process, Introduce BrowserWindow::OnTabDetached()
    
    When closing a tab with old API, expected order of calls are..
    
    1. Browser::TabDetached
    2. BrowserView::TabDetached -> this resets contents_web_view_.
    3. Browser::ActiveTabChanged() -> This will call
    BrowserWindow(BrowserView)::OnActiveTabChange() : Set new contents to
    contents_web_view_
    
    But, if we use the new observer API it would be
    
    1. Browser::OnTabStripModelChanged()
        * handles things Browser::TabDetached() used to do.
        * handles things Browser::ActiveTabChanged() used to
    2. BrowserView::OnTabStripModelChanged()
        * handles BrowserView:TabDetachedAt() used to do.
    
    As a result, contents_web_view_ is cleared out with null
    contents.
    
    Repro step and the result would be,
    1. Open browser
    2. Create new tab
    3. Close active tab.
    -> Then new active tab's contents won't be visible.
    
    Therefore, Introduce BrowserWindow::OnTabDetached() and
    let the Browser control the flow.
    
    Change-Id: I88c08f05d365f83146602197374299d4b4fdb14c
    Reviewed-on: https://chromium-review.googlesource.com/c/1205975
    Commit-Queue: Sang Woo Ko <sangwoo108@chromium.org>
    Reviewed-by: default avatarScott Violet <sky@chromium.org>
    Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#601844}
    40e8e763
browser_view.cc 113 KB