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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 24 matching lines...) Expand all Loading... |
35 // Macros to simplify specifying the type. | 35 // Macros to simplify specifying the type. |
36 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ | 36 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ |
37 Experiment::SINGLE_VALUE, command_line_switch, switch_value, NULL, 0 | 37 Experiment::SINGLE_VALUE, command_line_switch, switch_value, NULL, 0 |
38 #define SINGLE_VALUE_TYPE(command_line_switch) \ | 38 #define SINGLE_VALUE_TYPE(command_line_switch) \ |
39 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") | 39 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") |
40 #define MULTI_VALUE_TYPE(choices) \ | 40 #define MULTI_VALUE_TYPE(choices) \ |
41 Experiment::MULTI_VALUE, "", "", choices, arraysize(choices) | 41 Experiment::MULTI_VALUE, "", "", choices, arraysize(choices) |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS; | 45 const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid; |
46 | 46 |
47 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates | 47 // Adds a |StringValue| to |list| for each platform where |bitmask| indicates |
48 // whether the experiment is available on that platform. | 48 // whether the experiment is available on that platform. |
49 void AddOsStrings(unsigned bitmask, ListValue* list) { | 49 void AddOsStrings(unsigned bitmask, ListValue* list) { |
50 struct { | 50 struct { |
51 unsigned bit; | 51 unsigned bit; |
52 const char* const name; | 52 const char* const name; |
53 } kBitsToOs[] = { | 53 } kBitsToOs[] = { |
54 {kOsMac, "Mac"}, | 54 {kOsMac, "Mac"}, |
55 {kOsWin, "Windows"}, | 55 {kOsWin, "Windows"}, |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 | 769 |
770 int GetCurrentPlatform() { | 770 int GetCurrentPlatform() { |
771 #if defined(OS_MACOSX) | 771 #if defined(OS_MACOSX) |
772 return kOsMac; | 772 return kOsMac; |
773 #elif defined(OS_WIN) | 773 #elif defined(OS_WIN) |
774 return kOsWin; | 774 return kOsWin; |
775 #elif defined(OS_CHROMEOS) // Needs to be before the OS_LINUX check. | 775 #elif defined(OS_CHROMEOS) // Needs to be before the OS_LINUX check. |
776 return kOsCrOS; | 776 return kOsCrOS; |
777 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 777 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
778 return kOsLinux; | 778 return kOsLinux; |
| 779 #elif defined(OS_ANDROID) |
| 780 return kOsAndroid; |
779 #else | 781 #else |
780 #error Unknown platform | 782 #error Unknown platform |
781 #endif | 783 #endif |
782 } | 784 } |
783 | 785 |
784 void RecordUMAStatistics(const PrefService* prefs) { | 786 void RecordUMAStatistics(const PrefService* prefs) { |
785 std::set<std::string> flags; | 787 std::set<std::string> flags; |
786 GetEnabledFlags(prefs, &flags); | 788 GetEnabledFlags(prefs, &flags); |
787 for (std::set<std::string>::iterator it = flags.begin(); it != flags.end(); | 789 for (std::set<std::string>::iterator it = flags.begin(); it != flags.end(); |
788 ++it) { | 790 ++it) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 } | 960 } |
959 | 961 |
960 const Experiment* GetExperiments(size_t* count) { | 962 const Experiment* GetExperiments(size_t* count) { |
961 *count = num_experiments; | 963 *count = num_experiments; |
962 return experiments; | 964 return experiments; |
963 } | 965 } |
964 | 966 |
965 } // namespace testing | 967 } // namespace testing |
966 | 968 |
967 } // namespace about_flags | 969 } // namespace about_flags |
OLD | NEW |