| 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 #include <dispatch/dispatch.h> | 10 #include <dispatch/dispatch.h> |
| 11 #import <Foundation/Foundation.h> | 11 #import <Foundation/Foundation.h> |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "components/autofill/core/common/autofill_switches.h" | 18 #include "components/autofill/core/common/autofill_switches.h" |
| 19 #include "components/variations/variations_associated_data.h" | 19 #include "components/variations/variations_associated_data.h" |
| 20 #include "ios/chrome/browser/chrome_switches.h" | 20 #include "ios/chrome/browser/chrome_switches.h" |
| 21 #include "ios/web/public/web_view_creation_util.h" | 21 #include "ios/web/public/web_view_creation_util.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 NSString* const kEnableAlertOnBackgroundUpload = | 24 NSString* const kEnableAlertOnBackgroundUpload = |
| 25 @"EnableAlertsOnBackgroundUpload"; | 25 @"EnableAlertsOnBackgroundUpload"; |
| 26 NSString* const kEnableViewCopyPasswords = @"EnableViewCopyPasswords"; | 26 NSString* const kEnableViewCopyPasswords = @"EnableViewCopyPasswords"; |
| 27 NSString* const kHeuristicsForPasswordGeneration = | 27 NSString* const kHeuristicsForPasswordGeneration = |
| 28 @"HeuristicsForPasswordGeneration"; | 28 @"HeuristicsForPasswordGeneration"; |
| 29 NSString* const kEnableReadingList = @"EnableReadingList"; | 29 NSString* const kEnableReadingList = @"EnableReadingList"; |
| 30 NSString* const kUpdatePasswordUIEnabled = @"UpdatePasswordUIEnabled"; | 30 NSString* const kUpdatePasswordUIDisabled = @"UpdatePasswordUIDisabled"; |
| 31 NSString* const kEnableQRCodeReader = @"EnableQRCodeReader"; | 31 NSString* const kEnableQRCodeReader = @"EnableQRCodeReader"; |
| 32 NSString* const kEnableNewClearBrowsingDataUI = @"EnableNewClearBrowsingDataUI"; | 32 NSString* const kEnableNewClearBrowsingDataUI = @"EnableNewClearBrowsingDataUI"; |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 namespace experimental_flags { | 35 namespace experimental_flags { |
| 36 | 36 |
| 37 bool IsAlertOnBackgroundUploadEnabled() { | 37 bool IsAlertOnBackgroundUploadEnabled() { |
| 38 return [[NSUserDefaults standardUserDefaults] | 38 return [[NSUserDefaults standardUserDefaults] |
| 39 boolForKey:kEnableAlertOnBackgroundUpload]; | 39 boolForKey:kEnableAlertOnBackgroundUpload]; |
| 40 } | 40 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Check if the finch experiment is turned on | 135 // Check if the finch experiment is turned on |
| 136 std::string group_name = | 136 std::string group_name = |
| 137 base::FieldTrialList::FindFullName("PhysicalWebEnabled"); | 137 base::FieldTrialList::FindFullName("PhysicalWebEnabled"); |
| 138 return base::StartsWith(group_name, "Enabled", | 138 return base::StartsWith(group_name, "Enabled", |
| 139 base::CompareCase::INSENSITIVE_ASCII); | 139 base::CompareCase::INSENSITIVE_ASCII); |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool IsUpdatePasswordUIEnabled() { | 142 bool IsUpdatePasswordUIEnabled() { |
| 143 return [[NSUserDefaults standardUserDefaults] | 143 return ![[NSUserDefaults standardUserDefaults] |
| 144 boolForKey:kUpdatePasswordUIEnabled]; | 144 boolForKey:kUpdatePasswordUIDisabled]; |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool IsQRCodeReaderEnabled() { | 147 bool IsQRCodeReaderEnabled() { |
| 148 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 148 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 149 if (command_line->HasSwitch(switches::kEnableQRScanner)) | 149 if (command_line->HasSwitch(switches::kEnableQRScanner)) |
| 150 return true; | 150 return true; |
| 151 | 151 |
| 152 // Check if the finch experiment is turned on. | 152 // Check if the finch experiment is turned on. |
| 153 return [[NSUserDefaults standardUserDefaults] | 153 return [[NSUserDefaults standardUserDefaults] |
| 154 boolForKey:kEnableQRCodeReader]; | 154 boolForKey:kEnableQRCodeReader]; |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool IsNewClearBrowsingDataUIEnabled() { | 157 bool IsNewClearBrowsingDataUIEnabled() { |
| 158 NSString* countersFlag = [[NSUserDefaults standardUserDefaults] | 158 NSString* countersFlag = [[NSUserDefaults standardUserDefaults] |
| 159 objectForKey:kEnableNewClearBrowsingDataUI]; | 159 objectForKey:kEnableNewClearBrowsingDataUI]; |
| 160 if ([countersFlag isEqualToString:@"Enabled"]) | 160 if ([countersFlag isEqualToString:@"Enabled"]) |
| 161 return true; | 161 return true; |
| 162 return false; | 162 return false; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace experimental_flags | 165 } // namespace experimental_flags |
| OLD | NEW |