Chromium Code Reviews| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 | 154 |
| 155 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as | 155 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as |
| 156 // the WebContents could be deleted if the user closed the tab. | 156 // the WebContents could be deleted if the user closed the tab. |
| 157 static int64_t IdFromWebContents(content::WebContents* web_contents); | 157 static int64_t IdFromWebContents(content::WebContents* web_contents); |
| 158 | 158 |
| 159 // Return whether tabs are being loaded during session restore. | 159 // Return whether tabs are being loaded during session restore. |
| 160 bool IsSessionRestoreLoadingTabs() const { | 160 bool IsSessionRestoreLoadingTabs() const { |
| 161 return is_session_restore_loading_tabs_; | 161 return is_session_restore_loading_tabs_; |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool HasSessionRestoreInitialForegroundTabChanged() const { | |
| 165 return initial_session_restore_foreground_tab_changed_; | |
| 166 } | |
| 167 | |
| 164 private: | 168 private: |
| 165 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); | 169 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); |
| 166 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); | 170 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); |
| 167 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); | 171 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); |
| 168 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); | 172 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); |
| 169 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); | 173 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); |
| 170 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); | 174 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); |
| 171 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); | 175 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); |
| 172 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); | 176 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); |
| 173 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); | 177 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 std::vector<BrowserInfo> test_browser_info_list_; | 385 std::vector<BrowserInfo> test_browser_info_list_; |
| 382 | 386 |
| 383 // List of observers that will receive notifications on state changes. | 387 // List of observers that will receive notifications on state changes. |
| 384 base::ObserverList<TabManagerObserver> observers_; | 388 base::ObserverList<TabManagerObserver> observers_; |
| 385 | 389 |
| 386 bool is_session_restore_loading_tabs_; | 390 bool is_session_restore_loading_tabs_; |
| 387 | 391 |
| 388 class TabManagerSessionRestoreObserver; | 392 class TabManagerSessionRestoreObserver; |
| 389 std::unique_ptr<TabManagerSessionRestoreObserver> session_restore_observer_; | 393 std::unique_ptr<TabManagerSessionRestoreObserver> session_restore_observer_; |
| 390 | 394 |
| 395 // Whether the user has switched from the initial foreground tab or not. | |
|
lpy
2017/06/30 19:13:50
True if initial foreground tab is switched away.
ducbui
2017/06/30 19:38:35
Done.
| |
| 396 bool initial_session_restore_foreground_tab_changed_; | |
| 397 | |
| 391 // Weak pointer factory used for posting delayed tasks. | 398 // Weak pointer factory used for posting delayed tasks. |
| 392 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 399 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 393 | 400 |
| 394 DISALLOW_COPY_AND_ASSIGN(TabManager); | 401 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 395 }; | 402 }; |
| 396 | 403 |
| 397 } // namespace resource_coordinator | 404 } // namespace resource_coordinator |
| 398 | 405 |
| 399 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 406 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
| OLD | NEW |