| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/labs.h" | 5 #include "chrome/browser/labs.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // The commandline parameter that's added when this lab is active. This is | 42 // The commandline parameter that's added when this lab is active. This is |
| 43 // different from |internal_name| so that the commandline flag can be | 43 // different from |internal_name| so that the commandline flag can be |
| 44 // renamed without breaking the prefs file. | 44 // renamed without breaking the prefs file. |
| 45 const char* command_line; | 45 const char* command_line; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 const Experiment kExperiments[] = { | 48 const Experiment kExperiments[] = { |
| 49 { | 49 { |
| 50 "expose-for-tabs", // Do not change; see above. | 50 "expose-for-tabs", // Do not change; see above. |
| 51 IDS_LABS_TABPOSE_NAME, | 51 IDS_FLAGS_TABPOSE_NAME, |
| 52 IDS_LABS_TABPOSE_DESCRIPTION, | 52 IDS_FLAGS_TABPOSE_DESCRIPTION, |
| 53 kOsMac, | 53 kOsMac, |
| 54 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 55 // The switch exists only on OS X. | 55 // The switch exists only on OS X. |
| 56 switches::kEnableExposeForTabs | 56 switches::kEnableExposeForTabs |
| 57 #else | 57 #else |
| 58 "" | 58 "" |
| 59 #endif | 59 #endif |
| 60 }, | 60 }, |
| 61 { | 61 { |
| 62 "vertical-tabs", // Do not change; see above. | 62 "vertical-tabs", // Do not change; see above. |
| 63 IDS_LABS_SIDE_TABS_NAME, | 63 IDS_FLAGS_SIDE_TABS_NAME, |
| 64 IDS_LABS_SIDE_TABS_DESCRIPTION, | 64 IDS_FLAGS_SIDE_TABS_DESCRIPTION, |
| 65 kOsWin, | 65 kOsWin, |
| 66 switches::kEnableVerticalTabs | 66 switches::kEnableVerticalTabs |
| 67 }, | 67 }, |
| 68 { | 68 { |
| 69 "tabbed-options", // Do not change; see above. | 69 "tabbed-options", // Do not change; see above. |
| 70 IDS_LABS_TABBED_OPTIONS_NAME, | 70 IDS_FLAGS_TABBED_OPTIONS_NAME, |
| 71 IDS_LABS_TABBED_OPTIONS_DESCRIPTION, | 71 IDS_FLAGS_TABBED_OPTIONS_DESCRIPTION, |
| 72 kOsAll, | 72 kOsAll, |
| 73 switches::kEnableTabbedOptions | 73 switches::kEnableTabbedOptions |
| 74 }, | 74 }, |
| 75 { | 75 { |
| 76 "remoting", // Do not change; see above. | 76 "remoting", // Do not change; see above. |
| 77 IDS_LABS_REMOTING_NAME, | 77 IDS_FLAGS_REMOTING_NAME, |
| 78 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
| 79 // Windows only supports host functionality at the moment. | 79 // Windows only supports host functionality at the moment. |
| 80 IDS_LABS_REMOTING_HOST_DESCRIPTION, | 80 IDS_FLAGS_REMOTING_HOST_DESCRIPTION, |
| 81 #elif defined(OS_LINUX) | 81 #elif defined(OS_LINUX) |
| 82 // Linux only supports client functionality at the moment. | 82 // Linux only supports client functionality at the moment. |
| 83 IDS_LABS_REMOTING_CLIENT_DESCRIPTION, | 83 IDS_FLAGS_REMOTING_CLIENT_DESCRIPTION, |
| 84 #else | 84 #else |
| 85 // On other platforms, this lab isn't available at all. | 85 // On other platforms, this lab isn't available at all. |
| 86 0, | 86 0, |
| 87 #endif | 87 #endif |
| 88 kOsWin | kOsLinux, | 88 kOsWin | kOsLinux, |
| 89 switches::kEnableRemoting | 89 switches::kEnableRemoting |
| 90 }, | 90 }, |
| 91 { | 91 { |
| 92 "disable-outdated-plugins", // Do not change; see above. | 92 "disable-outdated-plugins", // Do not change; see above. |
| 93 IDS_LABS_DISABLE_OUTDATED_PLUGINS_NAME, | 93 IDS_FLAGS_DISABLE_OUTDATED_PLUGINS_NAME, |
| 94 IDS_LABS_DISABLE_OUTDATED_PLUGINS_DESCRIPTION, | 94 IDS_FLAGS_DISABLE_OUTDATED_PLUGINS_DESCRIPTION, |
| 95 kOsAll, | 95 kOsAll, |
| 96 switches::kDisableOutdatedPlugins | 96 switches::kDisableOutdatedPlugins |
| 97 }, | 97 }, |
| 98 { | 98 { |
| 99 "xss-auditor", // Do not change; see above. | 99 "xss-auditor", // Do not change; see above. |
| 100 IDS_LABS_XSS_AUDITOR_NAME, | 100 IDS_FLAGS_XSS_AUDITOR_NAME, |
| 101 IDS_LABS_XSS_AUDITOR_DESCRIPTION, | 101 IDS_FLAGS_XSS_AUDITOR_DESCRIPTION, |
| 102 kOsAll, | 102 kOsAll, |
| 103 switches::kEnableXSSAuditor | 103 switches::kEnableXSSAuditor |
| 104 }, | 104 }, |
| 105 { | 105 { |
| 106 "background-webapps", // Do not change; see above | 106 "background-webapps", // Do not change; see above |
| 107 IDS_LABS_BACKGROUND_WEBAPPS_NAME, | 107 IDS_FLAGS_BACKGROUND_WEBAPPS_NAME, |
| 108 IDS_LABS_BACKGROUND_WEBAPPS_DESCRIPTION, | 108 IDS_FLAGS_BACKGROUND_WEBAPPS_DESCRIPTION, |
| 109 kOsAll, | 109 kOsAll, |
| 110 switches::kEnableBackgroundMode | 110 switches::kEnableBackgroundMode |
| 111 }, | 111 }, |
| 112 { | 112 { |
| 113 "cloud-print-proxy", // Do not change; see above. | 113 "cloud-print-proxy", // Do not change; see above. |
| 114 IDS_LABS_CLOUD_PRINT_PROXY_NAME, | 114 IDS_FLAGS_CLOUD_PRINT_PROXY_NAME, |
| 115 IDS_LABS_CLOUD_PRINT_PROXY_DESCRIPTION, | 115 IDS_FLAGS_CLOUD_PRINT_PROXY_DESCRIPTION, |
| 116 #if defined(GOOGLE_CHROME_BUILD) | 116 #if defined(GOOGLE_CHROME_BUILD) |
| 117 // For a Chrome build, we know we have a PDF plug-in, and so we'll | 117 // For a Chrome build, we know we have a PDF plug-in, and so we'll |
| 118 // enable by platform as we get things working. | 118 // enable by platform as we get things working. |
| 119 0, | 119 0, |
| 120 #else | 120 #else |
| 121 // Otherwise, where we know it could be working if a viable PDF | 121 // Otherwise, where we know it could be working if a viable PDF |
| 122 // plug-in could be supplied, we'll keep the lab enabled. | 122 // plug-in could be supplied, we'll keep the lab enabled. |
| 123 kOsWin, | 123 kOsWin, |
| 124 #endif | 124 #endif |
| 125 switches::kEnableCloudPrintProxy | 125 switches::kEnableCloudPrintProxy |
| 126 }, | 126 }, |
| 127 { | 127 { |
| 128 "match-preview", // Do not change; see above. | 128 "match-preview", // Do not change; see above. |
| 129 IDS_LABS_INSTANT_NAME, | 129 IDS_FLAGS_INSTANT_NAME, |
| 130 IDS_LABS_INSTANT_DESCRIPTION, | 130 IDS_FLAGS_INSTANT_DESCRIPTION, |
| 131 kOsMac, | 131 kOsMac, |
| 132 switches::kEnableMatchPreview | 132 switches::kEnableMatchPreview |
| 133 }, | 133 }, |
| 134 // FIXME(scheib): Add Labs entry for accelerated Compositing, | 134 // FIXME(scheib): Add Labs entry for accelerated Compositing, |
| 135 // or pull it and the strings in generated_resources.grd by Dec 2010 | 135 // or pull it and the strings in generated_resources.grd by Dec 2010 |
| 136 //{ | 136 //{ |
| 137 // "gpu-compositing", // Do not change; see above | 137 // "gpu-compositing", // Do not change; see above |
| 138 // IDS_LABS_ACCELERATED_COMPOSITING_NAME, | 138 // IDS_FLAGS_ACCELERATED_COMPOSITING_NAME, |
| 139 // IDS_LABS_ACCELERATED_COMPOSITING_DESCRIPTION, | 139 // IDS_FLAGS_ACCELERATED_COMPOSITING_DESCRIPTION, |
| 140 // kOsAll, | 140 // kOsAll, |
| 141 // switches::kDisableAcceleratedCompositing | 141 // switches::kDisableAcceleratedCompositing |
| 142 //}, | 142 //}, |
| 143 { | 143 { |
| 144 "gpu-canvas-2d", // Do not change; see above | 144 "gpu-canvas-2d", // Do not change; see above |
| 145 IDS_LABS_ACCELERATED_CANVAS_2D_NAME, | 145 IDS_FLAGS_ACCELERATED_CANVAS_2D_NAME, |
| 146 IDS_LABS_ACCELERATED_CANVAS_2D_DESCRIPTION, | 146 IDS_FLAGS_ACCELERATED_CANVAS_2D_DESCRIPTION, |
| 147 kOsWin | kOsLinux, | 147 kOsWin | kOsLinux, |
| 148 switches::kEnableAccelerated2dCanvas | 148 switches::kEnableAccelerated2dCanvas |
| 149 } | 149 } |
| 150 // FIXME(scheib): Add Labs entry for WebGL, | 150 // FIXME(scheib): Add Labs entry for WebGL, |
| 151 // or pull it and the strings in generated_resources.grd by Dec 2010 | 151 // or pull it and the strings in generated_resources.grd by Dec 2010 |
| 152 //{ | 152 //{ |
| 153 // "webgl", // Do not change; see above | 153 // "webgl", // Do not change; see above |
| 154 // IDS_LABS_WEBGL_NAME, | 154 // IDS_FLAGS_WEBGL_NAME, |
| 155 // IDS_LABS_WEBGL_DESCRIPTION, | 155 // IDS_FLAGS_WEBGL_DESCRIPTION, |
| 156 // kOsAll, | 156 // kOsAll, |
| 157 // switches::kDisableExperimentalWebGL | 157 // switches::kDisableExperimentalWebGL |
| 158 //} | 158 //} |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // Extracts the list of enabled lab experiments from preferences and stores them | 161 // Extracts the list of enabled lab experiments from preferences and stores them |
| 162 // in a set. | 162 // in a set. |
| 163 void GetEnabledLabs(const PrefService* prefs, std::set<std::string>* result) { | 163 void GetEnabledLabs(const PrefService* prefs, std::set<std::string>* result) { |
| 164 const ListValue* enabled_experiments = prefs->GetList( | 164 const ListValue* enabled_experiments = prefs->GetList( |
| 165 prefs::kEnabledLabsExperiments); | 165 prefs::kEnabledLabsExperiments); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 if (enable) | 314 if (enable) |
| 315 enabled_experiments.insert(internal_name); | 315 enabled_experiments.insert(internal_name); |
| 316 else | 316 else |
| 317 enabled_experiments.erase(internal_name); | 317 enabled_experiments.erase(internal_name); |
| 318 | 318 |
| 319 SetEnabledLabs(prefs, enabled_experiments); | 319 SetEnabledLabs(prefs, enabled_experiments); |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace Labs | 322 } // namespace Labs |
| OLD | NEW |