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

Side by Side Diff: components/variations/variations_http_header_provider.h

Issue 2182553002: Add other variations (with ids) for NTPSnippets to chrome://flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alexei's comment #5 + fix a bug Created 4 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_HTTP_HEADER_PROVIDER_H_ 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_HTTP_HEADER_PROVIDER_H_
6 #define COMPONENTS_VARIATIONS_VARIATIONS_HTTP_HEADER_PROVIDER_H_ 6 #define COMPONENTS_VARIATIONS_VARIATIONS_HTTP_HEADER_PROVIDER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 23 matching lines...) Expand all
34 // Returns the value of the client data header, computing and caching it if 34 // Returns the value of the client data header, computing and caching it if
35 // necessary. 35 // necessary.
36 std::string GetClientDataHeader(); 36 std::string GetClientDataHeader();
37 37
38 // Returns a space-separated string containing the list of current active 38 // Returns a space-separated string containing the list of current active
39 // variations (as would be reported in the |variation_id| repeated field of 39 // variations (as would be reported in the |variation_id| repeated field of
40 // the ClientVariations proto). The returned string is guaranteed to have a 40 // the ClientVariations proto). The returned string is guaranteed to have a
41 // a leading and trailing space, e.g. " 123 234 345 ". 41 // a leading and trailing space, e.g. " 123 234 345 ".
42 std::string GetVariationsString(); 42 std::string GetVariationsString();
43 43
44 // Forces the list of |variation_ids| (which will be modified by adding the
45 // comma-separated |command_line_variation_ids|). This is a wrapper function
46 // around SetDefaultVariationIds.
47 bool ForceVariationIds(
48 const std::string& command_line_variation_ids,
49 std::vector<std::string>* variation_ids);
50
44 // Sets *additional* variation ids and trigger variation ids to be encoded in 51 // Sets *additional* variation ids and trigger variation ids to be encoded in
45 // the X-Client-Data request header. This is intended for development use to 52 // the X-Client-Data request header. This is intended for development use to
46 // force a server side experiment id. |variation_ids| should be a 53 // force a server side experiment id. |variation_ids| should be a list of
47 // comma-separated string of numeric experiment ids. If an id is prefixed 54 // strings of numeric experiment ids. If an id is prefixed with "t" it will
48 // with "t" it will be treated as a trigger experiment id. 55 // be treated as a trigger experiment id.
49 bool SetDefaultVariationIds(const std::string& variation_ids); 56 bool SetDefaultVariationIds(const std::vector<std::string>& variation_ids);
50 57
51 // Resets any cached state for tests. 58 // Resets any cached state for tests.
52 void ResetForTesting(); 59 void ResetForTesting();
53 60
54 private: 61 private:
55 friend struct base::DefaultSingletonTraits<VariationsHttpHeaderProvider>; 62 friend struct base::DefaultSingletonTraits<VariationsHttpHeaderProvider>;
56 63
57 FRIEND_TEST_ALL_PREFIXES(VariationsHttpHeaderProviderTest, 64 FRIEND_TEST_ALL_PREFIXES(VariationsHttpHeaderProviderTest,
58 SetDefaultVariationIds_Valid); 65 SetDefaultVariationIds_Valid);
59 FRIEND_TEST_ALL_PREFIXES(VariationsHttpHeaderProviderTest, 66 FRIEND_TEST_ALL_PREFIXES(VariationsHttpHeaderProviderTest,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 std::set<VariationID> synthetic_variation_ids_set_; 117 std::set<VariationID> synthetic_variation_ids_set_;
111 118
112 std::string variation_ids_header_; 119 std::string variation_ids_header_;
113 120
114 DISALLOW_COPY_AND_ASSIGN(VariationsHttpHeaderProvider); 121 DISALLOW_COPY_AND_ASSIGN(VariationsHttpHeaderProvider);
115 }; 122 };
116 123
117 } // namespace variations 124 } // namespace variations
118 125
119 #endif // COMPONENTS_VARIATIONS_VARIATIONS_HTTP_HEADER_PROVIDER_H_ 126 #endif // COMPONENTS_VARIATIONS_VARIATIONS_HTTP_HEADER_PROVIDER_H_
OLDNEW
« no previous file with comments | « components/variations/variations_associated_data.cc ('k') | components/variations/variations_http_header_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698