Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: chrome/browser/about_flags.cc

Issue 578333003: Workaround to remove command line flag on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/bookmarks/DEPS » ('j') | chrome/browser/bookmarks/DEPS » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <iterator> 7 #include <iterator>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 if (new_enabled_experiments != enabled_experiments) 2010 if (new_enabled_experiments != enabled_experiments)
2011 flags_storage->SetFlags(new_enabled_experiments); 2011 flags_storage->SetFlags(new_enabled_experiments);
2012 } 2012 }
2013 2013
2014 void GetSanitizedEnabledFlags( 2014 void GetSanitizedEnabledFlags(
2015 FlagsStorage* flags_storage, std::set<std::string>* result) { 2015 FlagsStorage* flags_storage, std::set<std::string>* result) {
2016 SanitizeList(flags_storage); 2016 SanitizeList(flags_storage);
2017 *result = flags_storage->GetFlags(); 2017 *result = flags_storage->GetFlags();
2018 } 2018 }
2019 2019
2020 bool SkipConditionalExperiment(const Experiment& experiment) { 2020 bool SkipConditionalExperiment(const Experiment& experiment,
2021 FlagsStorage* flags_storage) {
2021 if (experiment.internal_name == 2022 if (experiment.internal_name ==
2022 std::string("enhanced-bookmarks-experiment")) { 2023 std::string("enhanced-bookmarks-experiment")) {
2023 #if defined(OS_ANDROID) 2024 #if defined(OS_ANDROID)
2024 // On Android, user can opt in. 2025 // On Android, user can opt in.
2025 return false; 2026 return false;
2026 #else 2027 #else
2027 CommandLine* command_line = CommandLine::ForCurrentProcess(); 2028 CommandLine* command_line = CommandLine::ForCurrentProcess();
2028 // Dont't skip experiment if it has non default value. 2029 // Dont't skip experiment if it has non default value.
2029 // It means user selected it. 2030 // It means user selected it.
2030 if (command_line->HasSwitch(switches::kEnhancedBookmarksExperiment)) 2031 if (command_line->HasSwitch(switches::kEnhancedBookmarksExperiment))
2031 return false; 2032 return false;
2032 2033
2033 return !IsEnhancedBookmarksExperimentEnabled(); 2034 return !IsEnhancedBookmarksExperimentEnabled(flags_storage);
2034 #endif 2035 #endif
2035 } 2036 }
2036 2037
2037 if ((experiment.internal_name == std::string("manual-enhanced-bookmarks")) || 2038 if ((experiment.internal_name == std::string("manual-enhanced-bookmarks")) ||
2038 (experiment.internal_name == 2039 (experiment.internal_name ==
2039 std::string("manual-enhanced-bookmarks-optout"))) { 2040 std::string("manual-enhanced-bookmarks-optout"))) {
2040 return true; 2041 return true;
2041 } 2042 }
2042 2043
2043 #if defined(OS_ANDROID) 2044 #if defined(OS_ANDROID)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 FlagAccess access, 2166 FlagAccess access,
2166 base::ListValue* supported_experiments, 2167 base::ListValue* supported_experiments,
2167 base::ListValue* unsupported_experiments) { 2168 base::ListValue* unsupported_experiments) {
2168 std::set<std::string> enabled_experiments; 2169 std::set<std::string> enabled_experiments;
2169 GetSanitizedEnabledFlags(flags_storage, &enabled_experiments); 2170 GetSanitizedEnabledFlags(flags_storage, &enabled_experiments);
2170 2171
2171 int current_platform = GetCurrentPlatform(); 2172 int current_platform = GetCurrentPlatform();
2172 2173
2173 for (size_t i = 0; i < num_experiments; ++i) { 2174 for (size_t i = 0; i < num_experiments; ++i) {
2174 const Experiment& experiment = experiments[i]; 2175 const Experiment& experiment = experiments[i];
2175 if (SkipConditionalExperiment(experiment)) 2176 if (SkipConditionalExperiment(experiment, flags_storage))
2176 continue; 2177 continue;
2177 2178
2178 base::DictionaryValue* data = new base::DictionaryValue(); 2179 base::DictionaryValue* data = new base::DictionaryValue();
2179 data->SetString("internal_name", experiment.internal_name); 2180 data->SetString("internal_name", experiment.internal_name);
2180 data->SetString("name", 2181 data->SetString("name",
2181 l10n_util::GetStringUTF16(experiment.visible_name_id)); 2182 l10n_util::GetStringUTF16(experiment.visible_name_id));
2182 data->SetString("description", 2183 data->SetString("description",
2183 l10n_util::GetStringUTF16( 2184 l10n_util::GetStringUTF16(
2184 experiment.visible_description_id)); 2185 experiment.visible_description_id));
2185 2186
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 it != enabled_experiments.end(); 2363 it != enabled_experiments.end();
2363 ++it) { 2364 ++it) {
2364 const std::string& experiment_name = *it; 2365 const std::string& experiment_name = *it;
2365 NameToSwitchAndValueMap::const_iterator name_to_switch_it = 2366 NameToSwitchAndValueMap::const_iterator name_to_switch_it =
2366 name_to_switch_map.find(experiment_name); 2367 name_to_switch_map.find(experiment_name);
2367 if (name_to_switch_it == name_to_switch_map.end()) { 2368 if (name_to_switch_it == name_to_switch_map.end()) {
2368 NOTREACHED(); 2369 NOTREACHED();
2369 continue; 2370 continue;
2370 } 2371 }
2371 2372
2373 #if defined(OS_CHROMEOS)
2374 if (experiment_name == "manual-enhanced-bookmarks") {
sky 2014/09/24 17:22:09 nit: no {} And add a description as to why this is
yefimt 2014/09/24 18:46:12 Done.
2375 continue;
2376 }
2377 #endif
2378
2372 const std::pair<std::string, std::string>& 2379 const std::pair<std::string, std::string>&
2373 switch_and_value_pair = name_to_switch_it->second; 2380 switch_and_value_pair = name_to_switch_it->second;
2374 2381
2375 CHECK(!switch_and_value_pair.first.empty()); 2382 CHECK(!switch_and_value_pair.first.empty());
2376 command_line->AppendSwitchASCII(switch_and_value_pair.first, 2383 command_line->AppendSwitchASCII(switch_and_value_pair.first,
2377 switch_and_value_pair.second); 2384 switch_and_value_pair.second);
2378 flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second; 2385 flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second;
2379 } 2386 }
2380 if (sentinels == kAddSentinels) { 2387 if (sentinels == kAddSentinels) {
2381 command_line->AppendSwitch(switches::kFlagSwitchesEnd); 2388 command_line->AppendSwitch(switches::kFlagSwitchesEnd);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 } 2500 }
2494 2501
2495 const Experiment* GetExperiments(size_t* count) { 2502 const Experiment* GetExperiments(size_t* count) {
2496 *count = num_experiments; 2503 *count = num_experiments;
2497 return experiments; 2504 return experiments;
2498 } 2505 }
2499 2506
2500 } // namespace testing 2507 } // namespace testing
2501 2508
2502 } // namespace about_flags 2509 } // namespace about_flags
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/DEPS » ('j') | chrome/browser/bookmarks/DEPS » ('J')

Powered by Google App Engine
This is Rietveld 408576698