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 <iterator> | 7 #include <iterator> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/metrics/sparse_histogram.h" | 14 #include "base/metrics/sparse_histogram.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
21 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | |
22 #include "chrome/browser/flags_storage.h" | 21 #include "chrome/browser/flags_storage.h" |
23 #include "chrome/common/chrome_content_client.h" | 22 #include "chrome/common/chrome_content_client.h" |
24 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
26 #include "components/autofill/core/common/autofill_switches.h" | 25 #include "components/autofill/core/common/autofill_switches.h" |
27 #include "components/cloud_devices/common/cloud_devices_switches.h" | 26 #include "components/cloud_devices/common/cloud_devices_switches.h" |
28 #include "components/metrics/metrics_hashes.h" | 27 #include "components/metrics/metrics_hashes.h" |
29 #include "components/nacl/common/nacl_switches.h" | 28 #include "components/nacl/common/nacl_switches.h" |
30 #include "components/omnibox/omnibox_switches.h" | 29 #include "components/omnibox/omnibox_switches.h" |
31 #include "components/proximity_auth/switches.h" | 30 #include "components/proximity_auth/switches.h" |
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 #endif | 1639 #endif |
1641 { | 1640 { |
1642 "enhanced-bookmarks-experiment", | 1641 "enhanced-bookmarks-experiment", |
1643 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_NAME, | 1642 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_NAME, |
1644 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_DESCRIPTION, | 1643 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_DESCRIPTION, |
1645 kOsDesktop | kOsAndroid, | 1644 kOsDesktop | kOsAndroid, |
1646 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE( | 1645 ENABLE_DISABLE_VALUE_TYPE_AND_VALUE( |
1647 switches::kEnhancedBookmarksExperiment, "1", | 1646 switches::kEnhancedBookmarksExperiment, "1", |
1648 switches::kEnhancedBookmarksExperiment, "0") | 1647 switches::kEnhancedBookmarksExperiment, "0") |
1649 }, | 1648 }, |
1650 { | |
1651 "manual-enhanced-bookmarks", | |
1652 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_NAME, | |
1653 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_DESCRIPTION, | |
1654 kOsDesktop | kOsAndroid, | |
1655 SINGLE_VALUE_TYPE(switches::kManualEnhancedBookmarks) | |
1656 }, | |
1657 { | |
1658 "manual-enhanced-bookmarks-optout", | |
1659 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_NAME, | |
1660 IDS_FLAGS_ENABLE_ENHANCED_BOOKMARKS_DESCRIPTION, | |
1661 kOsDesktop | kOsAndroid, | |
1662 SINGLE_VALUE_TYPE(switches::kManualEnhancedBookmarksOptout) | |
1663 }, | |
1664 #if defined(OS_ANDROID) | 1649 #if defined(OS_ANDROID) |
1665 { | 1650 { |
1666 "enable-zero-suggest-experiment", | 1651 "enable-zero-suggest-experiment", |
1667 IDS_FLAGS_ZERO_SUGGEST_EXPERIMENT_NAME, | 1652 IDS_FLAGS_ZERO_SUGGEST_EXPERIMENT_NAME, |
1668 IDS_FLAGS_ZERO_SUGGEST_EXPERIMENT_DESCRIPTION, | 1653 IDS_FLAGS_ZERO_SUGGEST_EXPERIMENT_DESCRIPTION, |
1669 kOsAndroid, | 1654 kOsAndroid, |
1670 MULTI_VALUE_TYPE(kZeroSuggestExperimentsChoices) | 1655 MULTI_VALUE_TYPE(kZeroSuggestExperimentsChoices) |
1671 }, | 1656 }, |
1672 { | 1657 { |
1673 "enable-reader-mode-toolbar-icon", | 1658 "enable-reader-mode-toolbar-icon", |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 } | 2308 } |
2324 | 2309 |
2325 void GetSanitizedEnabledFlags( | 2310 void GetSanitizedEnabledFlags( |
2326 FlagsStorage* flags_storage, std::set<std::string>* result) { | 2311 FlagsStorage* flags_storage, std::set<std::string>* result) { |
2327 SanitizeList(flags_storage); | 2312 SanitizeList(flags_storage); |
2328 *result = flags_storage->GetFlags(); | 2313 *result = flags_storage->GetFlags(); |
2329 } | 2314 } |
2330 | 2315 |
2331 bool SkipConditionalExperiment(const Experiment& experiment, | 2316 bool SkipConditionalExperiment(const Experiment& experiment, |
2332 FlagsStorage* flags_storage) { | 2317 FlagsStorage* flags_storage) { |
2333 if ((experiment.internal_name == std::string("manual-enhanced-bookmarks")) || | |
2334 (experiment.internal_name == | |
2335 std::string("manual-enhanced-bookmarks-optout"))) { | |
2336 return true; | |
2337 } | |
2338 | |
2339 #if defined(OS_ANDROID) || defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 2318 #if defined(OS_ANDROID) || defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
2340 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 2319 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
2341 #endif | 2320 #endif |
2342 | 2321 |
2343 #if defined(OS_ANDROID) | 2322 #if defined(OS_ANDROID) |
2344 // enable-data-reduction-proxy-dev is only available for the Dev/Beta channel. | 2323 // enable-data-reduction-proxy-dev is only available for the Dev/Beta channel. |
2345 if (!strcmp("enable-data-reduction-proxy-dev", experiment.internal_name) && | 2324 if (!strcmp("enable-data-reduction-proxy-dev", experiment.internal_name) && |
2346 channel != chrome::VersionInfo::CHANNEL_BETA && | 2325 channel != chrome::VersionInfo::CHANNEL_BETA && |
2347 channel != chrome::VersionInfo::CHANNEL_DEV) { | 2326 channel != chrome::VersionInfo::CHANNEL_DEV) { |
2348 return true; | 2327 return true; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 std::string())); | 2660 std::string())); |
2682 } | 2661 } |
2683 for (const std::string& experiment_name : enabled_experiments) { | 2662 for (const std::string& experiment_name : enabled_experiments) { |
2684 NameToSwitchAndValueMap::const_iterator name_to_switch_it = | 2663 NameToSwitchAndValueMap::const_iterator name_to_switch_it = |
2685 name_to_switch_map.find(experiment_name); | 2664 name_to_switch_map.find(experiment_name); |
2686 if (name_to_switch_it == name_to_switch_map.end()) { | 2665 if (name_to_switch_it == name_to_switch_map.end()) { |
2687 NOTREACHED(); | 2666 NOTREACHED(); |
2688 continue; | 2667 continue; |
2689 } | 2668 } |
2690 | 2669 |
2691 #if defined(OS_CHROMEOS) | |
2692 // On Chrome OS setting command line flag may make browser to restart on | |
2693 // user login. As this flag eventually will be set to a significant number | |
2694 // of users skip manual-enhanced-bookmarks to avoid restart. | |
2695 if (experiment_name == "manual-enhanced-bookmarks") | |
2696 continue; | |
2697 #endif | |
2698 | |
2699 const std::pair<std::string, std::string>& | 2670 const std::pair<std::string, std::string>& |
2700 switch_and_value_pair = name_to_switch_it->second; | 2671 switch_and_value_pair = name_to_switch_it->second; |
2701 | 2672 |
2702 CHECK(!switch_and_value_pair.first.empty()); | 2673 CHECK(!switch_and_value_pair.first.empty()); |
2703 command_line->AppendSwitchASCII(switch_and_value_pair.first, | 2674 command_line->AppendSwitchASCII(switch_and_value_pair.first, |
2704 switch_and_value_pair.second); | 2675 switch_and_value_pair.second); |
2705 flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second; | 2676 flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second; |
2706 } | 2677 } |
2707 if (sentinels == kAddSentinels) { | 2678 if (sentinels == kAddSentinels) { |
2708 command_line->AppendSwitch(switches::kFlagSwitchesEnd); | 2679 command_line->AppendSwitch(switches::kFlagSwitchesEnd); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 } | 2791 } |
2821 | 2792 |
2822 const Experiment* GetExperiments(size_t* count) { | 2793 const Experiment* GetExperiments(size_t* count) { |
2823 *count = num_experiments; | 2794 *count = num_experiments; |
2824 return experiments; | 2795 return experiments; |
2825 } | 2796 } |
2826 | 2797 |
2827 } // namespace testing | 2798 } // namespace testing |
2828 | 2799 |
2829 } // namespace about_flags | 2800 } // namespace about_flags |
OLD | NEW |