| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Implementation of about_flags for iOS that sets flags based on experimental | 5 // Implementation of about_flags for iOS that sets flags based on experimental |
| 6 // settings. | 6 // settings. |
| 7 | 7 |
| 8 #include "ios/chrome/browser/about_flags.h" | 8 #include "ios/chrome/browser/about_flags.h" |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "components/flags_ui/feature_entry.h" | 24 #include "components/flags_ui/feature_entry.h" |
| 25 #include "components/flags_ui/feature_entry_macros.h" | 25 #include "components/flags_ui/feature_entry_macros.h" |
| 26 #include "components/flags_ui/flags_storage.h" | 26 #include "components/flags_ui/flags_storage.h" |
| 27 #include "components/flags_ui/flags_ui_switches.h" | 27 #include "components/flags_ui/flags_ui_switches.h" |
| 28 #include "components/ntp_tiles/switches.h" | 28 #include "components/ntp_tiles/switches.h" |
| 29 #include "components/reading_list/core/reading_list_switches.h" | 29 #include "components/reading_list/core/reading_list_switches.h" |
| 30 #include "components/strings/grit/components_strings.h" | 30 #include "components/strings/grit/components_strings.h" |
| 31 #include "components/sync/driver/sync_driver_switches.h" | 31 #include "components/sync/driver/sync_driver_switches.h" |
| 32 #include "google_apis/gaia/gaia_switches.h" | 32 #include "google_apis/gaia/gaia_switches.h" |
| 33 #include "ios/chrome/browser/chrome_switches.h" | 33 #include "ios/chrome/browser/chrome_switches.h" |
| 34 #include "ios/chrome/browser/google_api_keys.h" |
| 34 #include "ios/chrome/grit/ios_strings.h" | 35 #include "ios/chrome/grit/ios_strings.h" |
| 35 #include "ios/web/public/user_agent.h" | 36 #include "ios/web/public/user_agent.h" |
| 36 #include "ios/web/public/web_view_creation_util.h" | 37 #include "ios/web/public/web_view_creation_util.h" |
| 37 | 38 |
| 38 #if !defined(OFFICIAL_BUILD) | 39 #if !defined(OFFICIAL_BUILD) |
| 39 #include "components/variations/variations_switches.h" | 40 #include "components/variations/variations_switches.h" |
| 40 #endif | 41 #endif |
| 41 | 42 |
| 42 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 43 #error "This file requires ARC support." | |
| 44 #endif | |
| 45 | |
| 46 namespace { | 43 namespace { |
| 47 // To add a new entry, add to the end of kFeatureEntries. There are two | 44 // To add a new entry, add to the end of kFeatureEntries. There are two |
| 48 // distinct types of entries: | 45 // distinct types of entries: |
| 49 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE | 46 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE |
| 50 // macro for this type supplying the command line to the macro. | 47 // macro for this type supplying the command line to the macro. |
| 51 // . MULTI_VALUE: a list of choices, the first of which should correspond to a | 48 // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
| 52 // deactivated state for this lab (i.e. no command line option). To specify | 49 // deactivated state for this lab (i.e. no command line option). To specify |
| 53 // this type of entry use the macro MULTI_VALUE_TYPE supplying it the | 50 // this type of entry use the macro MULTI_VALUE_TYPE supplying it the |
| 54 // array of choices. | 51 // array of choices. |
| 55 // See the documentation of FeatureEntry for details on the fields. | 52 // See the documentation of FeatureEntry for details on the fields. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 72 | 69 |
| 73 // Add all switches from experimental flags to |command_line|. | 70 // Add all switches from experimental flags to |command_line|. |
| 74 void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { | 71 void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { |
| 75 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 72 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 76 | 73 |
| 77 // GAIA staging environment. | 74 // GAIA staging environment. |
| 78 NSString* kGAIAEnvironment = @"GAIAEnvironment"; | 75 NSString* kGAIAEnvironment = @"GAIAEnvironment"; |
| 79 NSString* gaia_environment = [defaults stringForKey:kGAIAEnvironment]; | 76 NSString* gaia_environment = [defaults stringForKey:kGAIAEnvironment]; |
| 80 if ([gaia_environment isEqualToString:@"Staging"]) { | 77 if ([gaia_environment isEqualToString:@"Staging"]) { |
| 81 command_line->AppendSwitchASCII(switches::kGoogleApisUrl, | 78 command_line->AppendSwitchASCII(switches::kGoogleApisUrl, |
| 82 GOOGLE_STAGING_API_URL); | 79 BUILDFLAG(GOOGLE_STAGING_API_URL)); |
| 83 command_line->AppendSwitchASCII(switches::kLsoUrl, GOOGLE_STAGING_LSO_URL); | 80 command_line->AppendSwitchASCII(switches::kLsoUrl, |
| 81 BUILDFLAG(GOOGLE_STAGING_LSO_URL)); |
| 84 } else if ([gaia_environment isEqualToString:@"Test"]) { | 82 } else if ([gaia_environment isEqualToString:@"Test"]) { |
| 85 command_line->AppendSwitchASCII(switches::kGaiaUrl, GOOGLE_TEST_OAUTH_URL); | 83 command_line->AppendSwitchASCII(switches::kGaiaUrl, |
| 84 BUILDFLAG(GOOGLE_TEST_OAUTH_URL)); |
| 86 command_line->AppendSwitchASCII(switches::kGoogleApisUrl, | 85 command_line->AppendSwitchASCII(switches::kGoogleApisUrl, |
| 87 GOOGLE_TEST_API_URL); | 86 BUILDFLAG(GOOGLE_TEST_API_URL)); |
| 88 command_line->AppendSwitchASCII(switches::kLsoUrl, GOOGLE_TEST_LSO_URL); | 87 command_line->AppendSwitchASCII(switches::kLsoUrl, |
| 88 BUILDFLAG(GOOGLE_TEST_LSO_URL)); |
| 89 command_line->AppendSwitchASCII(switches::kSyncServiceURL, | 89 command_line->AppendSwitchASCII(switches::kSyncServiceURL, |
| 90 GOOGLE_TEST_SYNC_URL); | 90 BUILDFLAG(GOOGLE_TEST_SYNC_URL)); |
| 91 command_line->AppendSwitchASCII(switches::kOAuth2ClientID, | 91 command_line->AppendSwitchASCII(switches::kOAuth2ClientID, |
| 92 GOOGLE_TEST_OAUTH_CLIENT_ID); | 92 BUILDFLAG(GOOGLE_TEST_OAUTH_CLIENT_ID)); |
| 93 command_line->AppendSwitchASCII(switches::kOAuth2ClientSecret, | 93 command_line->AppendSwitchASCII(switches::kOAuth2ClientSecret, |
| 94 GOOGLE_TEST_OAUTH_CLIENT_SECRET); | 94 BUILDFLAG(GOOGLE_TEST_OAUTH_CLIENT_SECRET)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Populate command line flag for the Tab Switcher experiment from the | 97 // Populate command line flag for the Tab Switcher experiment from the |
| 98 // configuration plist. | 98 // configuration plist. |
| 99 NSString* enableTabSwitcher = [defaults stringForKey:@"EnableTabSwitcher"]; | 99 NSString* enableTabSwitcher = [defaults stringForKey:@"EnableTabSwitcher"]; |
| 100 if ([enableTabSwitcher isEqualToString:@"Enabled"]) { | 100 if ([enableTabSwitcher isEqualToString:@"Enabled"]) { |
| 101 command_line->AppendSwitch(switches::kEnableTabSwitcher); | 101 command_line->AppendSwitch(switches::kEnableTabSwitcher); |
| 102 } else if ([enableTabSwitcher isEqualToString:@"Disabled"]) { | 102 } else if ([enableTabSwitcher isEqualToString:@"Disabled"]) { |
| 103 command_line->AppendSwitch(switches::kDisableTabSwitcher); | 103 command_line->AppendSwitch(switches::kDisableTabSwitcher); |
| 104 } | 104 } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } | 341 } |
| 342 | 342 |
| 343 namespace testing { | 343 namespace testing { |
| 344 | 344 |
| 345 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { | 345 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { |
| 346 *count = arraysize(kFeatureEntries); | 346 *count = arraysize(kFeatureEntries); |
| 347 return kFeatureEntries; | 347 return kFeatureEntries; |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace testing | 350 } // namespace testing |
| OLD | NEW |