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/about_flags.h" | 5 #include "chrome/browser/about_flags.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void AddOsStrings(unsigned bitmask, ListValue* list) { | 79 void AddOsStrings(unsigned bitmask, ListValue* list) { |
80 struct { | 80 struct { |
81 unsigned bit; | 81 unsigned bit; |
82 const char* const name; | 82 const char* const name; |
83 } kBitsToOs[] = { | 83 } kBitsToOs[] = { |
84 {kOsMac, "Mac"}, | 84 {kOsMac, "Mac"}, |
85 {kOsWin, "Windows"}, | 85 {kOsWin, "Windows"}, |
86 {kOsLinux, "Linux"}, | 86 {kOsLinux, "Linux"}, |
87 {kOsCrOS, "Chrome OS"}, | 87 {kOsCrOS, "Chrome OS"}, |
88 {kOsAndroid, "Android"}, | 88 {kOsAndroid, "Android"}, |
| 89 {kOsCrOSOwnerOnly, "Chrome OS (owner only)"}, |
89 }; | 90 }; |
90 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kBitsToOs); ++i) | 91 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kBitsToOs); ++i) |
91 if (bitmask & kBitsToOs[i].bit) | 92 if (bitmask & kBitsToOs[i].bit) |
92 list->Append(new StringValue(kBitsToOs[i].name)); | 93 list->Append(new StringValue(kBitsToOs[i].name)); |
93 } | 94 } |
94 | 95 |
95 const Experiment::Choice kOmniboxHistoryQuickProviderNewScoringChoices[] = { | 96 const Experiment::Choice kOmniboxHistoryQuickProviderNewScoringChoices[] = { |
96 { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_AUTOMATIC, "", "" }, | 97 { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_AUTOMATIC, "", "" }, |
97 { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_ENABLED, | 98 { IDS_FLAGS_OMNIBOX_HISTORY_QUICK_PROVIDER_NEW_SCORING_ENABLED, |
98 switches::kOmniboxHistoryQuickProviderNewScoring, | 99 switches::kOmniboxHistoryQuickProviderNewScoring, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME, | 320 IDS_FLAGS_FORCE_COMPOSITING_MODE_NAME, |
320 IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION, | 321 IDS_FLAGS_FORCE_COMPOSITING_MODE_DESCRIPTION, |
321 kOsMac | kOsWin | kOsLinux, | 322 kOsMac | kOsWin | kOsLinux, |
322 ENABLE_DISABLE_VALUE_TYPE(switches::kForceCompositingMode, | 323 ENABLE_DISABLE_VALUE_TYPE(switches::kForceCompositingMode, |
323 switches::kDisableForceCompositingMode) | 324 switches::kDisableForceCompositingMode) |
324 }, | 325 }, |
325 { | 326 { |
326 "threaded-compositing-mode", | 327 "threaded-compositing-mode", |
327 IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME, | 328 IDS_FLAGS_THREADED_COMPOSITING_MODE_NAME, |
328 IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION, | 329 IDS_FLAGS_THREADED_COMPOSITING_MODE_DESCRIPTION, |
329 kOsDesktop & ~kOsCrOS, | 330 kOsMac | kOsWin | kOsLinux, |
330 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableThreadedCompositing, | 331 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableThreadedCompositing, |
331 switches::kDisableThreadedCompositing) | 332 switches::kDisableThreadedCompositing) |
332 }, | 333 }, |
333 { | 334 { |
334 "force-accelerated-composited-scrolling", | 335 "force-accelerated-composited-scrolling", |
335 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_NAME, | 336 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_NAME, |
336 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_DESCRIPTION, | 337 IDS_FLAGS_FORCE_ACCELERATED_OVERFLOW_SCROLL_MODE_DESCRIPTION, |
337 kOsAll, | 338 kOsAll, |
338 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAcceleratedOverflowScroll, | 339 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableAcceleratedOverflowScroll, |
339 switches::kDisableAcceleratedOverflowScroll) | 340 switches::kDisableAcceleratedOverflowScroll) |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 "enable-vp9-playback", | 719 "enable-vp9-playback", |
719 IDS_FLAGS_ENABLE_VP9_PLAYBACK_NAME, | 720 IDS_FLAGS_ENABLE_VP9_PLAYBACK_NAME, |
720 IDS_FLAGS_ENABLE_VP9_PLAYBACK_DESCRIPTION, | 721 IDS_FLAGS_ENABLE_VP9_PLAYBACK_DESCRIPTION, |
721 kOsDesktop, | 722 kOsDesktop, |
722 SINGLE_VALUE_TYPE(switches::kEnableVp9Playback) | 723 SINGLE_VALUE_TYPE(switches::kEnableVp9Playback) |
723 }, | 724 }, |
724 { | 725 { |
725 "enable-managed-users", | 726 "enable-managed-users", |
726 IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_NAME, | 727 IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_NAME, |
727 IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_DESCRIPTION, | 728 IDS_FLAGS_ENABLE_LOCALLY_MANAGED_USERS_DESCRIPTION, |
728 kOsAll, | 729 kOsMac | kOsWin | kOsLinux | kOsAndroid | kOsCrOSOwnerOnly, |
729 SINGLE_VALUE_TYPE(switches::kEnableManagedUsers) | 730 SINGLE_VALUE_TYPE(switches::kEnableManagedUsers) |
730 }, | 731 }, |
731 #if defined(USE_ASH) | 732 #if defined(USE_ASH) |
732 { | 733 { |
733 "ash-disable-auto-window-placement", | 734 "ash-disable-auto-window-placement", |
734 IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_NAME, | 735 IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_NAME, |
735 IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_DESCRIPTION, | 736 IDS_FLAGS_ASH_AUTO_WINDOW_PLACEMENT_DESCRIPTION, |
736 kOsWin | kOsLinux | kOsCrOS, | 737 kOsWin | kOsLinux | kOsCrOS, |
737 SINGLE_VALUE_TYPE(ash::switches::kAshDisableAutoWindowPlacement) | 738 SINGLE_VALUE_TYPE(ash::switches::kAshDisableAutoWindowPlacement) |
738 }, | 739 }, |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_DESCRIPTION, | 1002 IDS_FLAGS_ENABLE_APP_LIST_SHOW_APPS_ONLY_DESCRIPTION, |
1002 kOsAll, | 1003 kOsAll, |
1003 SINGLE_VALUE_TYPE(app_list::switches::kAppListShowAppsOnly), | 1004 SINGLE_VALUE_TYPE(app_list::switches::kAppListShowAppsOnly), |
1004 }, | 1005 }, |
1005 #endif // defined(USE_ASH) | 1006 #endif // defined(USE_ASH) |
1006 #if defined(OS_CHROMEOS) | 1007 #if defined(OS_CHROMEOS) |
1007 { | 1008 { |
1008 "disable-boot-animation", | 1009 "disable-boot-animation", |
1009 IDS_FLAGS_DISABLE_BOOT_ANIMATION, | 1010 IDS_FLAGS_DISABLE_BOOT_ANIMATION, |
1010 IDS_FLAGS_DISABLE_BOOT_ANIMATION_DESCRIPTION, | 1011 IDS_FLAGS_DISABLE_BOOT_ANIMATION_DESCRIPTION, |
1011 kOsCrOS, | 1012 kOsCrOSOwnerOnly, |
1012 SINGLE_VALUE_TYPE(switches::kDisableBootAnimation), | 1013 SINGLE_VALUE_TYPE(switches::kDisableBootAnimation), |
1013 }, | 1014 }, |
1014 { | 1015 { |
1015 "disable-boot-animation2", | 1016 "disable-boot-animation2", |
1016 IDS_FLAGS_DISABLE_BOOT_ANIMATION2, | 1017 IDS_FLAGS_DISABLE_BOOT_ANIMATION2, |
1017 IDS_FLAGS_DISABLE_BOOT_ANIMATION2_DESCRIPTION, | 1018 IDS_FLAGS_DISABLE_BOOT_ANIMATION2_DESCRIPTION, |
1018 kOsCrOS, | 1019 kOsCrOSOwnerOnly, |
1019 SINGLE_VALUE_TYPE(ash::switches::kAshDisableBootAnimation2), | 1020 SINGLE_VALUE_TYPE(ash::switches::kAshDisableBootAnimation2), |
1020 }, | 1021 }, |
1021 { | 1022 { |
1022 "boot-animation-fucntion", | 1023 "boot-animation-fucntion", |
1023 IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION, | 1024 IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION, |
1024 IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION_DESCRIPTION, | 1025 IDS_FLAGS_ASH_BOOT_ANIMATION_FUNCTION_DESCRIPTION, |
1025 kOsCrOS, | 1026 kOsCrOSOwnerOnly, |
1026 MULTI_VALUE_TYPE(kAshBootAnimationFunction), | 1027 MULTI_VALUE_TYPE(kAshBootAnimationFunction), |
1027 }, | 1028 }, |
1028 { | 1029 { |
1029 "captive-portal-detector", | 1030 "captive-portal-detector", |
1030 IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_NAME, | 1031 IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_NAME, |
1031 IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_DESCRIPTION, | 1032 IDS_FLAGS_CAPTIVE_PORTAL_DETECTOR_DESCRIPTION, |
1032 kOsCrOS, | 1033 kOsCrOSOwnerOnly, |
1033 MULTI_VALUE_TYPE(kChromeCaptivePortalDetectionChoices), | 1034 MULTI_VALUE_TYPE(kChromeCaptivePortalDetectionChoices), |
1034 }, | 1035 }, |
1035 { | 1036 { |
1036 "disable-new-lock-animations", | 1037 "disable-new-lock-animations", |
1037 IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS, | 1038 IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS, |
1038 IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS_DESCRIPTION, | 1039 IDS_FLAGS_ASH_NEW_LOCK_ANIMATIONS_DESCRIPTION, |
1039 kOsCrOS, | 1040 kOsCrOS, |
1040 SINGLE_VALUE_TYPE(ash::switches::kAshDisableNewLockAnimations), | 1041 SINGLE_VALUE_TYPE(ash::switches::kAshDisableNewLockAnimations), |
1041 }, | 1042 }, |
1042 { | 1043 { |
1043 "file-manager-packaged", | 1044 "file-manager-packaged", |
1044 IDS_FLAGS_FILE_MANAGER_PACKAGED_NAME, | 1045 IDS_FLAGS_FILE_MANAGER_PACKAGED_NAME, |
1045 IDS_FLAGS_FILE_MANAGER_PACKAGED_DESCRIPTION, | 1046 IDS_FLAGS_FILE_MANAGER_PACKAGED_DESCRIPTION, |
1046 kOsCrOS, | 1047 kOsCrOS, |
1047 SINGLE_VALUE_TYPE(switches::kFileManagerPackaged), | 1048 SINGLE_VALUE_TYPE(switches::kFileManagerPackaged), |
1048 }, | 1049 }, |
1049 { | 1050 { |
1050 "disable-launcher-per-display", | 1051 "disable-launcher-per-display", |
1051 IDS_FLAGS_DISABLE_LAUNCHER_PER_DISPLAY_NAME, | 1052 IDS_FLAGS_DISABLE_LAUNCHER_PER_DISPLAY_NAME, |
1052 IDS_FLAGS_DISABLE_LAUNCHER_PER_DISPLAY_DESCRIPTION, | 1053 IDS_FLAGS_DISABLE_LAUNCHER_PER_DISPLAY_DESCRIPTION, |
1053 kOsCrOS, | 1054 kOsCrOS, |
1054 SINGLE_VALUE_TYPE(ash::switches::kAshDisableLauncherPerDisplay), | 1055 SINGLE_VALUE_TYPE(ash::switches::kAshDisableLauncherPerDisplay), |
1055 }, | 1056 }, |
1056 { | 1057 { |
1057 "disable-app-mode", | 1058 "disable-app-mode", |
1058 IDS_FLAGS_DISABLE_KIOSK_APPS_NAME, | 1059 IDS_FLAGS_DISABLE_KIOSK_APPS_NAME, |
1059 IDS_FLAGS_DISABLE_KIOSK_APPS_DESCRIPTION, | 1060 IDS_FLAGS_DISABLE_KIOSK_APPS_DESCRIPTION, |
1060 kOsCrOS, | 1061 kOsCrOSOwnerOnly, |
1061 SINGLE_VALUE_TYPE(switches::kDisableAppMode), | 1062 SINGLE_VALUE_TYPE(switches::kDisableAppMode), |
1062 }, | 1063 }, |
1063 { | 1064 { |
1064 "disable-force-fullscreen-app", | 1065 "disable-force-fullscreen-app", |
1065 IDS_FLAGS_DISABLE_FULLSCREEN_APP_NAME, | 1066 IDS_FLAGS_DISABLE_FULLSCREEN_APP_NAME, |
1066 IDS_FLAGS_DISABLE_FULLSCREEN_APP_DESCRIPTION, | 1067 IDS_FLAGS_DISABLE_FULLSCREEN_APP_DESCRIPTION, |
1067 kOsCrOS, | 1068 kOsCrOS, |
1068 SINGLE_VALUE_TYPE(switches::kDisableFullscreenApp), | 1069 SINGLE_VALUE_TYPE(switches::kDisableFullscreenApp), |
1069 }, | 1070 }, |
1070 #endif // defined(OS_CHROMEOS) | 1071 #endif // defined(OS_CHROMEOS) |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 GetSanitizedEnabledFlags(prefs, result); | 1492 GetSanitizedEnabledFlags(prefs, result); |
1492 | 1493 |
1493 // Filter out any experiments that aren't enabled on the current platform. We | 1494 // Filter out any experiments that aren't enabled on the current platform. We |
1494 // don't remove these from prefs else syncing to a platform with a different | 1495 // don't remove these from prefs else syncing to a platform with a different |
1495 // set of experiments would be lossy. | 1496 // set of experiments would be lossy. |
1496 std::set<std::string> platform_experiments; | 1497 std::set<std::string> platform_experiments; |
1497 int current_platform = GetCurrentPlatform(); | 1498 int current_platform = GetCurrentPlatform(); |
1498 for (size_t i = 0; i < num_experiments; ++i) { | 1499 for (size_t i = 0; i < num_experiments; ++i) { |
1499 if (experiments[i].supported_platforms & current_platform) | 1500 if (experiments[i].supported_platforms & current_platform) |
1500 AddInternalName(experiments[i], &platform_experiments); | 1501 AddInternalName(experiments[i], &platform_experiments); |
| 1502 #if defined(OS_CHROMEOS) |
| 1503 if (experiments[i].supported_platforms & kOsCrOSOwnerOnly) |
| 1504 AddInternalName(experiments[i], &platform_experiments); |
| 1505 #endif |
1501 } | 1506 } |
1502 | 1507 |
1503 std::set<std::string> new_enabled_experiments; | 1508 std::set<std::string> new_enabled_experiments; |
1504 std::set_intersection( | 1509 std::set_intersection( |
1505 platform_experiments.begin(), platform_experiments.end(), | 1510 platform_experiments.begin(), platform_experiments.end(), |
1506 result->begin(), result->end(), | 1511 result->begin(), result->end(), |
1507 std::inserter(new_enabled_experiments, new_enabled_experiments.begin())); | 1512 std::inserter(new_enabled_experiments, new_enabled_experiments.begin())); |
1508 | 1513 |
1509 result->swap(new_enabled_experiments); | 1514 result->swap(new_enabled_experiments); |
1510 } | 1515 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 } else { | 1556 } else { |
1552 description_id = choices[index].description_id; | 1557 description_id = choices[index].description_id; |
1553 } | 1558 } |
1554 return l10n_util::GetStringUTF16(description_id); | 1559 return l10n_util::GetStringUTF16(description_id); |
1555 } | 1560 } |
1556 | 1561 |
1557 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) { | 1562 void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line) { |
1558 FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs, command_line); | 1563 FlagsState::GetInstance()->ConvertFlagsToSwitches(prefs, command_line); |
1559 } | 1564 } |
1560 | 1565 |
1561 ListValue* GetFlagsExperimentsData(PrefService* prefs) { | 1566 ListValue* GetFlagsExperimentsData(PrefService* prefs, FlagAccess access) { |
1562 std::set<std::string> enabled_experiments; | 1567 std::set<std::string> enabled_experiments; |
1563 GetSanitizedEnabledFlags(prefs, &enabled_experiments); | 1568 GetSanitizedEnabledFlags(prefs, &enabled_experiments); |
1564 | 1569 |
1565 int current_platform = GetCurrentPlatform(); | 1570 int current_platform = GetCurrentPlatform(); |
1566 | 1571 |
1567 ListValue* experiments_data = new ListValue(); | 1572 ListValue* experiments_data = new ListValue(); |
1568 for (size_t i = 0; i < num_experiments; ++i) { | 1573 for (size_t i = 0; i < num_experiments; ++i) { |
1569 const Experiment& experiment = experiments[i]; | 1574 const Experiment& experiment = experiments[i]; |
1570 | 1575 |
1571 #if defined(OS_ANDROID) | 1576 #if defined(OS_ANDROID) |
1572 // Special case enable-spdy-proxy-auth, because it should only | 1577 // Special case enable-spdy-proxy-auth, because it should only |
1573 // be available on Dev and Beta channels. | 1578 // be available on Dev and Beta channels. |
1574 if (!strcmp("enable-spdy-proxy-auth", experiment.internal_name) && | 1579 if (!strcmp("enable-spdy-proxy-auth", experiment.internal_name) && |
1575 chrome::VersionInfo::GetChannel() == | 1580 chrome::VersionInfo::GetChannel() == |
1576 chrome::VersionInfo::CHANNEL_STABLE) | 1581 chrome::VersionInfo::CHANNEL_STABLE) |
1577 continue; | 1582 continue; |
1578 #endif | 1583 #endif |
1579 | 1584 |
1580 DictionaryValue* data = new DictionaryValue(); | 1585 DictionaryValue* data = new DictionaryValue(); |
1581 data->SetString("internal_name", experiment.internal_name); | 1586 data->SetString("internal_name", experiment.internal_name); |
1582 data->SetString("name", | 1587 data->SetString("name", |
1583 l10n_util::GetStringUTF16(experiment.visible_name_id)); | 1588 l10n_util::GetStringUTF16(experiment.visible_name_id)); |
1584 data->SetString("description", | 1589 data->SetString("description", |
1585 l10n_util::GetStringUTF16( | 1590 l10n_util::GetStringUTF16( |
1586 experiment.visible_description_id)); | 1591 experiment.visible_description_id)); |
1587 bool supported = !!(experiment.supported_platforms & current_platform); | 1592 bool supported = (experiment.supported_platforms & current_platform) != 0; |
| 1593 #if defined(OS_CHROMEOS) |
| 1594 if (access == kOwnerAccessToFlags && |
| 1595 (experiment.supported_platforms & kOsCrOSOwnerOnly) != 0) |
| 1596 supported = true; |
| 1597 #endif |
1588 data->SetBoolean("supported", supported); | 1598 data->SetBoolean("supported", supported); |
1589 | 1599 |
1590 ListValue* supported_platforms = new ListValue(); | 1600 ListValue* supported_platforms = new ListValue(); |
1591 AddOsStrings(experiment.supported_platforms, supported_platforms); | 1601 AddOsStrings(experiment.supported_platforms, supported_platforms); |
1592 data->Set("supported_platforms", supported_platforms); | 1602 data->Set("supported_platforms", supported_platforms); |
1593 | 1603 |
1594 switch (experiment.type) { | 1604 switch (experiment.type) { |
1595 case Experiment::SINGLE_VALUE: | 1605 case Experiment::SINGLE_VALUE: |
1596 data->SetBoolean( | 1606 data->SetBoolean( |
1597 "enabled", | 1607 "enabled", |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 } | 1854 } |
1845 | 1855 |
1846 const Experiment* GetExperiments(size_t* count) { | 1856 const Experiment* GetExperiments(size_t* count) { |
1847 *count = num_experiments; | 1857 *count = num_experiments; |
1848 return experiments; | 1858 return experiments; |
1849 } | 1859 } |
1850 | 1860 |
1851 } // namespace testing | 1861 } // namespace testing |
1852 | 1862 |
1853 } // namespace about_flags | 1863 } // namespace about_flags |
OLD | NEW |