| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
| 6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as | 184 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as |
| 185 // the WebContents could be deleted if the user closed the tab. | 185 // the WebContents could be deleted if the user closed the tab. |
| 186 static int64_t IdFromWebContents(content::WebContents* web_contents); | 186 static int64_t IdFromWebContents(content::WebContents* web_contents); |
| 187 | 187 |
| 188 // Return whether tabs are being loaded during session restore. | 188 // Return whether tabs are being loaded during session restore. |
| 189 bool IsSessionRestoreLoadingTabs() const { | 189 bool IsSessionRestoreLoadingTabs() const { |
| 190 return is_session_restore_loading_tabs_; | 190 return is_session_restore_loading_tabs_; |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool HasSessionRestoreInitialForegroundTabChanged() const { |
| 194 return initial_session_restore_foreground_tab_changed_; |
| 195 } |
| 196 |
| 193 private: | 197 private: |
| 194 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); | 198 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); |
| 195 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); | 199 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); |
| 196 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); | 200 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); |
| 197 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); | 201 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); |
| 198 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); | 202 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); |
| 199 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); | 203 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); |
| 200 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); | 204 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); |
| 201 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); | 205 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); |
| 202 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); | 206 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 std::vector<BrowserInfo> test_browser_info_list_; | 462 std::vector<BrowserInfo> test_browser_info_list_; |
| 459 | 463 |
| 460 // List of observers that will receive notifications on state changes. | 464 // List of observers that will receive notifications on state changes. |
| 461 base::ObserverList<TabManagerObserver> observers_; | 465 base::ObserverList<TabManagerObserver> observers_; |
| 462 | 466 |
| 463 bool is_session_restore_loading_tabs_; | 467 bool is_session_restore_loading_tabs_; |
| 464 | 468 |
| 465 class TabManagerSessionRestoreObserver; | 469 class TabManagerSessionRestoreObserver; |
| 466 std::unique_ptr<TabManagerSessionRestoreObserver> session_restore_observer_; | 470 std::unique_ptr<TabManagerSessionRestoreObserver> session_restore_observer_; |
| 467 | 471 |
| 472 // True if the initial foreground tab is switched away. |
| 473 bool initial_session_restore_foreground_tab_changed_; |
| 474 |
| 468 // The list of navigations that are delayed. | 475 // The list of navigations that are delayed. |
| 469 std::vector<BackgroundTabNavigationThrottle*> pending_navigations_; | 476 std::vector<BackgroundTabNavigationThrottle*> pending_navigations_; |
| 470 | 477 |
| 471 // The tabs that are currently loading. We will consider loading the next | 478 // The tabs that are currently loading. We will consider loading the next |
| 472 // background tab when these tabs have finished loading or a background tab | 479 // background tab when these tabs have finished loading or a background tab |
| 473 // is brought to foreground. | 480 // is brought to foreground. |
| 474 std::set<content::WebContents*> loading_contents_; | 481 std::set<content::WebContents*> loading_contents_; |
| 475 | 482 |
| 476 // GRC tab signal observer, receives tab scoped signal from GRC. | 483 // GRC tab signal observer, receives tab scoped signal from GRC. |
| 477 std::unique_ptr<GRCTabSignalObserver> grc_tab_signal_observer_; | 484 std::unique_ptr<GRCTabSignalObserver> grc_tab_signal_observer_; |
| 478 | 485 |
| 479 // Records UMAs for tab and system-related events and properties during | 486 // Records UMAs for tab and system-related events and properties during |
| 480 // session restore. | 487 // session restore. |
| 481 std::unique_ptr<TabManagerStatsCollector> tab_manager_stats_collector_; | 488 std::unique_ptr<TabManagerStatsCollector> tab_manager_stats_collector_; |
| 482 | 489 |
| 483 // Weak pointer factory used for posting delayed tasks. | 490 // Weak pointer factory used for posting delayed tasks. |
| 484 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 491 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 485 | 492 |
| 486 DISALLOW_COPY_AND_ASSIGN(TabManager); | 493 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 487 }; | 494 }; |
| 488 | 495 |
| 489 } // namespace resource_coordinator | 496 } // namespace resource_coordinator |
| 490 | 497 |
| 491 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 498 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
| OLD | NEW |