OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bookmarks/enhanced_bookmarks_features.h" | 5 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 DCHECK_EQ(id_hash.length(), base::kSHA1Length); | 33 DCHECK_EQ(id_hash.length(), base::kSHA1Length); |
34 std::string hash = base::HexEncode(id_hash.c_str(), id_hash.length()); | 34 std::string hash = base::HexEncode(id_hash.c_str(), id_hash.length()); |
35 | 35 |
36 if (IsBookmarksExtensionHash(hash)) | 36 if (IsBookmarksExtensionHash(hash)) |
37 return true; | 37 return true; |
38 } | 38 } |
39 return false; | 39 return false; |
40 } | 40 } |
41 | 41 |
42 bool OptInIntoBookmarksExperiment(BookmarksExperimentState state) { | 42 bool OptInIntoBookmarksExperiment(BookmarksExperimentState state) { |
43 if (base::FieldTrialList::FindFullName(kFieldTrialName) != "Default") | |
44 return false; | |
45 | |
46 // Opt-in user into Finch group. | 43 // Opt-in user into Finch group. |
47 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 44 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
48 if (state == kBookmarksExperimentEnabledUserOptOut) | 45 if (state == kBookmarksExperimentEnabledUserOptOut) |
49 command_line->AppendSwitch(switches::kManualEnhancedBookmarksOptout); | 46 command_line->AppendSwitch(switches::kManualEnhancedBookmarksOptout); |
50 else | 47 else |
51 command_line->AppendSwitch(switches::kManualEnhancedBookmarks); | 48 command_line->AppendSwitch(switches::kManualEnhancedBookmarks); |
52 | 49 |
53 return true; | 50 return true; |
54 } | 51 } |
55 | 52 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (chrome_variations::GetVariationParamValue( | 84 if (chrome_variations::GetVariationParamValue( |
88 kFieldTrialName, "enable-sync-articles") == "1") | 85 kFieldTrialName, "enable-sync-articles") == "1") |
89 return true; | 86 return true; |
90 | 87 |
91 return false; | 88 return false; |
92 } | 89 } |
93 | 90 |
94 std::string GetEnhancedBookmarksExtensionIdFromFinch() { | 91 std::string GetEnhancedBookmarksExtensionIdFromFinch() { |
95 return chrome_variations::GetVariationParamValue(kFieldTrialName, "id"); | 92 return chrome_variations::GetVariationParamValue(kFieldTrialName, "id"); |
96 } | 93 } |
OLD | NEW |