Index: chrome/browser/resource_coordinator/tab_manager.h |
diff --git a/chrome/browser/resource_coordinator/tab_manager.h b/chrome/browser/resource_coordinator/tab_manager.h |
index 3cd08c9805cdf1b94d247b258eccbf52a03d346f..0f49f2ccfcc78c49c522e51f7cc289e6bf58dd1b 100644 |
--- a/chrome/browser/resource_coordinator/tab_manager.h |
+++ b/chrome/browser/resource_coordinator/tab_manager.h |
@@ -24,6 +24,7 @@ |
#include "build/build_config.h" |
#include "chrome/browser/resource_coordinator/tab_manager_observer.h" |
#include "chrome/browser/resource_coordinator/tab_stats.h" |
+#include "chrome/browser/sessions/session_restore_observer.h" |
#include "chrome/browser/ui/browser_tab_strip_tracker.h" |
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
#include "ui/gfx/geometry/rect.h" |
@@ -156,6 +157,11 @@ class TabManager : public TabStripModelObserver { |
// the WebContents could be deleted if the user closed the tab. |
static int64_t IdFromWebContents(content::WebContents* web_contents); |
+ // Return whether tabs are being loaded during session restore. |
+ bool IsInSessionRestoreTabLoading() const { |
+ return in_session_restore_tab_loading_; |
+ } |
+ |
private: |
FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); |
FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); |
@@ -321,6 +327,9 @@ class TabManager : public TabStripModelObserver { |
// list is constructed from either |test_browser_info_list_| or BrowserList. |
std::vector<BrowserInfo> GetBrowserInfoList() const; |
+ void OnSessionRestoreTabLoadingStarted(); |
+ void OnSessionRestoreTabLoadingEnded(); |
+ |
// Timer to periodically update the stats of the renderers. |
base::RepeatingTimer update_timer_; |
@@ -383,6 +392,23 @@ class TabManager : public TabStripModelObserver { |
// List of observers that will receive notifications on state changes. |
base::ObserverList<TabManagerObserver> observers_; |
+ bool in_session_restore_tab_loading_; |
+ |
+ class SessionRestoreObserverInstance : public SessionRestoreObserver { |
lpy
2017/06/23 22:35:57
Let's put this class to tab_manager.cc, and use di
ducbui
2017/06/23 23:30:14
Done.
|
+ public: |
+ explicit SessionRestoreObserverInstance(TabManager* tab_manager); |
+ ~SessionRestoreObserverInstance(); |
+ |
+ // SessionRestoreObserver implementation: |
+ void OnTabLoadingStarted() override; |
+ void OnTabLoadingEnded() override; |
+ |
+ private: |
+ TabManager* tab_manager_; |
+ }; |
+ |
+ SessionRestoreObserverInstance session_restore_observer_instance_; |
lpy
2017/06/23 22:35:57
just session_restore_observer_
ducbui
2017/06/23 23:30:14
Done.
|
+ |
// Weak pointer factory used for posting delayed tasks. |
base::WeakPtrFactory<TabManager> weak_ptr_factory_; |