Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file can be empty. Its purpose is to contain the relatively short lived | 5 // This file can be empty. Its purpose is to contain the relatively short lived |
| 6 // definitions required for experimental flags. | 6 // definitions required for experimental flags. |
| 7 | 7 |
| 8 #include "ios/chrome/browser/experimental_flags.h" | 8 #include "ios/chrome/browser/experimental_flags.h" |
| 9 | 9 |
| 10 #import <Foundation/Foundation.h> | 10 #import <Foundation/Foundation.h> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 | 47 |
| 48 void SetWKWebViewTrialEligibility(bool eligible) { | 48 void SetWKWebViewTrialEligibility(bool eligible) { |
| 49 // It's critical that the enabled state be consistently reported throughout | 49 // It's critical that the enabled state be consistently reported throughout |
| 50 // the life of the app, so ensure that this has not already been set. | 50 // the life of the app, so ensure that this has not already been set. |
| 51 DCHECK(g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET); | 51 DCHECK(g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET); |
| 52 | 52 |
| 53 g_wkwebview_trial_eligibility = eligible ? WKWebViewEligibility::ELIGIBLE | 53 g_wkwebview_trial_eligibility = eligible ? WKWebViewEligibility::ELIGIBLE |
| 54 : WKWebViewEligibility::INELIGIBLE; | 54 : WKWebViewEligibility::INELIGIBLE; |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool IsLRUSnapshotCacheEnabled() { | |
| 58 return true; | |
|
sdefresne
2015/11/03 16:58:08
I guess that this is debug code, can you remove?
jbbegue
2015/11/05 17:14:40
Done.
| |
| 59 // Check if the experimental flag is forced on or off. | |
| 60 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 61 if (command_line->HasSwitch(switches::kEnableLRUSnapshotCache)) { | |
| 62 return true; | |
| 63 } else if (command_line->HasSwitch(switches::kDisableLRUSnapshotCache)) { | |
| 64 return false; | |
| 65 } | |
| 66 | |
| 67 // Check if the finch experiment is turned on. | |
| 68 std::string group_name = | |
| 69 base::FieldTrialList::FindFullName("IOSLRUSnapshotCache"); | |
| 70 return base::StartsWith(group_name, "Enabled", | |
| 71 base::CompareCase::INSENSITIVE_ASCII); | |
| 72 } | |
| 73 | |
| 57 bool IsWKWebViewEnabled() { | 74 bool IsWKWebViewEnabled() { |
| 58 // If g_wkwebview_trial_eligibility hasn't been set, default it to | 75 // If g_wkwebview_trial_eligibility hasn't been set, default it to |
| 59 // ineligibile. This ensures future calls to try to set it will DCHECK. | 76 // ineligibile. This ensures future calls to try to set it will DCHECK. |
| 60 if (g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET) { | 77 if (g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET) { |
| 61 g_wkwebview_trial_eligibility = WKWebViewEligibility::INELIGIBLE; | 78 g_wkwebview_trial_eligibility = WKWebViewEligibility::INELIGIBLE; |
| 62 } | 79 } |
| 63 | 80 |
| 64 // If WKWebView isn't supported, don't activate the experiment at all. This | 81 // If WKWebView isn't supported, don't activate the experiment at all. This |
| 65 // avoids someone being slotted into the WKWebView bucket (and thus reporting | 82 // avoids someone being slotted into the WKWebView bucket (and thus reporting |
| 66 // as WKWebView), but actually running UIWebView. | 83 // as WKWebView), but actually running UIWebView. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 | 121 |
| 105 bool IsViewCopyPasswordsEnabled() { | 122 bool IsViewCopyPasswordsEnabled() { |
| 106 NSString* viewCopyPasswordFlag = [[NSUserDefaults standardUserDefaults] | 123 NSString* viewCopyPasswordFlag = [[NSUserDefaults standardUserDefaults] |
| 107 objectForKey:kEnableViewCopyPasswords]; | 124 objectForKey:kEnableViewCopyPasswords]; |
| 108 if ([viewCopyPasswordFlag isEqualToString:@"Enabled"]) | 125 if ([viewCopyPasswordFlag isEqualToString:@"Enabled"]) |
| 109 return true; | 126 return true; |
| 110 return false; | 127 return false; |
| 111 } | 128 } |
| 112 | 129 |
| 113 } // namespace experimental_flags | 130 } // namespace experimental_flags |
| OLD | NEW |