| 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 #include "chrome/browser/memory/tab_manager.h" | 5 #include "chrome/browser/memory/tab_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 content::WebContents* new_contents, | 791 content::WebContents* new_contents, |
| 792 int index, | 792 int index, |
| 793 int reason) { | 793 int reason) { |
| 794 GetWebContentsData(new_contents)->SetDiscardState(false); | 794 GetWebContentsData(new_contents)->SetDiscardState(false); |
| 795 // If |old_contents| is set, that tab has switched from being active to | 795 // If |old_contents| is set, that tab has switched from being active to |
| 796 // inactive, so record the time of that transition. | 796 // inactive, so record the time of that transition. |
| 797 if (old_contents) | 797 if (old_contents) |
| 798 GetWebContentsData(old_contents)->SetLastInactiveTime(NowTicks()); | 798 GetWebContentsData(old_contents)->SetLastInactiveTime(NowTicks()); |
| 799 } | 799 } |
| 800 | 800 |
| 801 void TabManager::TabInsertedAt(content::WebContents* contents, | 801 void TabManager::TabInsertedAt(TabStripModel* tab_strip_model, |
| 802 content::WebContents* contents, |
| 802 int index, | 803 int index, |
| 803 bool foreground) { | 804 bool foreground) { |
| 804 // Only interested in background tabs, as foreground tabs get taken care of by | 805 // Only interested in background tabs, as foreground tabs get taken care of by |
| 805 // ActiveTabChanged. | 806 // ActiveTabChanged. |
| 806 if (foreground) | 807 if (foreground) |
| 807 return; | 808 return; |
| 808 | 809 |
| 809 // A new background tab is similar to having a tab switch from being active to | 810 // A new background tab is similar to having a tab switch from being active to |
| 810 // inactive. | 811 // inactive. |
| 811 GetWebContentsData(contents)->SetLastInactiveTime(NowTicks()); | 812 GetWebContentsData(contents)->SetLastInactiveTime(NowTicks()); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 // platform. | 936 // platform. |
| 936 std::string allow_multiple_discards = variations::GetVariationParamValue( | 937 std::string allow_multiple_discards = variations::GetVariationParamValue( |
| 937 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); | 938 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); |
| 938 return (allow_multiple_discards != "true"); | 939 return (allow_multiple_discards != "true"); |
| 939 #else | 940 #else |
| 940 return false; | 941 return false; |
| 941 #endif | 942 #endif |
| 942 } | 943 } |
| 943 | 944 |
| 944 } // namespace memory | 945 } // namespace memory |
| OLD | NEW |