| 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/reading_list/reading_list_switches.h" |
| 19 #include "components/variations/variations_associated_data.h" | 20 #include "components/variations/variations_associated_data.h" |
| 20 #include "ios/chrome/browser/chrome_switches.h" | 21 #include "ios/chrome/browser/chrome_switches.h" |
| 21 #include "ios/web/public/web_view_creation_util.h" | 22 #include "ios/web/public/web_view_creation_util.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 NSString* const kEnableAlertOnBackgroundUpload = | 25 NSString* const kEnableAlertOnBackgroundUpload = |
| 25 @"EnableAlertsOnBackgroundUpload"; | 26 @"EnableAlertsOnBackgroundUpload"; |
| 26 NSString* const kEnableViewCopyPasswords = @"EnableViewCopyPasswords"; | 27 NSString* const kEnableViewCopyPasswords = @"EnableViewCopyPasswords"; |
| 27 NSString* const kHeuristicsForPasswordGeneration = | 28 NSString* const kHeuristicsForPasswordGeneration = |
| 28 @"HeuristicsForPasswordGeneration"; | 29 @"HeuristicsForPasswordGeneration"; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return false; | 96 return false; |
| 96 } | 97 } |
| 97 | 98 |
| 98 // Check if the finch experiment is turned on. | 99 // Check if the finch experiment is turned on. |
| 99 std::string group_name = base::FieldTrialList::FindFullName("IOSTabSwitcher"); | 100 std::string group_name = base::FieldTrialList::FindFullName("IOSTabSwitcher"); |
| 100 return base::StartsWith(group_name, "Enabled", | 101 return base::StartsWith(group_name, "Enabled", |
| 101 base::CompareCase::INSENSITIVE_ASCII); | 102 base::CompareCase::INSENSITIVE_ASCII); |
| 102 } | 103 } |
| 103 | 104 |
| 104 bool IsReadingListEnabled() { | 105 bool IsReadingListEnabled() { |
| 105 // Check if the experimental flag is forced on or off. | 106 return reading_list::switches::IsReadingListEnabled(); |
| 106 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 107 if (command_line->HasSwitch(switches::kEnableReadingList)) { | |
| 108 return true; | |
| 109 } | |
| 110 return false; | |
| 111 } | 107 } |
| 112 | 108 |
| 113 bool IsAllBookmarksEnabled() { | 109 bool IsAllBookmarksEnabled() { |
| 114 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 110 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 115 if (command_line->HasSwitch(switches::kEnableAllBookmarksView)) { | 111 if (command_line->HasSwitch(switches::kEnableAllBookmarksView)) { |
| 116 return true; | 112 return true; |
| 117 } else if (command_line->HasSwitch(switches::kDisableAllBookmarksView)) { | 113 } else if (command_line->HasSwitch(switches::kDisableAllBookmarksView)) { |
| 118 return false; | 114 return false; |
| 119 } | 115 } |
| 120 | 116 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 return ![[NSUserDefaults standardUserDefaults] | 181 return ![[NSUserDefaults standardUserDefaults] |
| 186 boolForKey:kMDMIntegrationDisabled]; | 182 boolForKey:kMDMIntegrationDisabled]; |
| 187 } | 183 } |
| 188 | 184 |
| 189 bool IsPendingIndexNavigationEnabled() { | 185 bool IsPendingIndexNavigationEnabled() { |
| 190 return [[NSUserDefaults standardUserDefaults] | 186 return [[NSUserDefaults standardUserDefaults] |
| 191 boolForKey:kPendingIndexNavigationEnabled]; | 187 boolForKey:kPendingIndexNavigationEnabled]; |
| 192 } | 188 } |
| 193 | 189 |
| 194 } // namespace experimental_flags | 190 } // namespace experimental_flags |
| OLD | NEW |