| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 #if defined(OS_WIN) || defined(OS_MACOSX) | 160 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 161 // If the feature is not enabled, do nothing. | 161 // If the feature is not enabled, do nothing. |
| 162 if (!base::FeatureList::IsEnabled(features::kAutomaticTabDiscarding)) | 162 if (!base::FeatureList::IsEnabled(features::kAutomaticTabDiscarding)) |
| 163 return; | 163 return; |
| 164 | 164 |
| 165 // Check the variation parameter to see if a tab be discarded more than once. | 165 // Check the variation parameter to see if a tab be discarded more than once. |
| 166 // Default is to only discard once per tab. | 166 // Default is to only discard once per tab. |
| 167 std::string allow_multiple_discards = variations::GetVariationParamValue( | 167 std::string allow_multiple_discards = variations::GetVariationParamValue( |
| 168 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); | 168 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); |
| 169 if (allow_multiple_discards == "true") | 169 if (allow_multiple_discards == "true") |
| 170 discard_once_ = false; |
| 171 else |
| 170 discard_once_ = true; | 172 discard_once_ = true; |
| 171 else | |
| 172 discard_once_ = false; | |
| 173 | 173 |
| 174 // Check the variation parameter to see if a tab is to be protected for an | 174 // Check the variation parameter to see if a tab is to be protected for an |
| 175 // amount of time after being backgrounded. The value is in seconds. | 175 // amount of time after being backgrounded. The value is in seconds. |
| 176 std::string minimum_protection_time_string = | 176 std::string minimum_protection_time_string = |
| 177 variations::GetVariationParamValue(features::kAutomaticTabDiscarding.name, | 177 variations::GetVariationParamValue(features::kAutomaticTabDiscarding.name, |
| 178 "MinimumProtectionTime"); | 178 "MinimumProtectionTime"); |
| 179 if (!minimum_protection_time_string.empty()) { | 179 if (!minimum_protection_time_string.empty()) { |
| 180 unsigned int minimum_protection_time_seconds = 0; | 180 unsigned int minimum_protection_time_seconds = 0; |
| 181 if (base::StringToUint(minimum_protection_time_string, | 181 if (base::StringToUint(minimum_protection_time_string, |
| 182 &minimum_protection_time_seconds)) { | 182 &minimum_protection_time_seconds)) { |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 } | 840 } |
| 841 } else { | 841 } else { |
| 842 // The code here can only be tested under a full browser test. | 842 // The code here can only be tested under a full browser test. |
| 843 AddTabStats(&stats_list); | 843 AddTabStats(&stats_list); |
| 844 } | 844 } |
| 845 | 845 |
| 846 return stats_list; | 846 return stats_list; |
| 847 } | 847 } |
| 848 | 848 |
| 849 } // namespace memory | 849 } // namespace memory |
| OLD | NEW |