• Mohammad Refaat's avatar
    SessionRestorationBrowserAgent to handle active webState changes · daec5894
    Mohammad Refaat authored
    SessionRestorationBrowserAgent now observers WebStateList to monitor
    the changes of the active webState, once the active webState is changed,
    unless the new webstate is loading the session is saved.
    
    This was handled previously by two observers:
    - TabModelClosingWebStateObserver for changes that happen when the
      active webstate is closed.
    - TabModelSelectedWebStateObserver for changes that happen when the
      active webstate is changed from one to another.
    But it seems that we don't need two observers, we only need to observe
    didChangeActiveWebState as it's also called when the active webState
    detached. and the webStateList is locked after that happens so saving
    the session at that point is the same as saving it on WillCloseWebState.
    
    With that in place, TabModelSelectedWebStateObserver is not needed
    anymore so it's deleted.
    
    Also Changed TabModelClosingWebStateObserver to be
    ClosingWebStateObserver as it has nothing to do with tabmodel. Updated
    its initializer and usages. And in a later iteration i'll try to find
    a place to move the functionalities that it does to other places.
    (right now it handles tabRestoration and snapshot removal).
    
    Bug: 1045142, 1010164
    Change-Id: I27ef8bf027ebb641230b56aecdc599acf807c1ef
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2018147
    Commit-Queue: Mohammad Refaat <mrefaat@chromium.org>
    Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
    Reviewed-by: default avatarMark Cogan <marq@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#735524}
    daec5894
test_session_service.h 977 Bytes