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 #ifndef COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ | 5 #ifndef COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ |
6 #define COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ | 6 #define COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // Starts the fetching process once, where |OnURLFetchComplete| is called with | 160 // Starts the fetching process once, where |OnURLFetchComplete| is called with |
161 // the response. | 161 // the response. |
162 virtual void DoActualFetch(); | 162 virtual void DoActualFetch(); |
163 | 163 |
164 // Stores the seed to prefs. Set as virtual and protected so that it can be | 164 // Stores the seed to prefs. Set as virtual and protected so that it can be |
165 // overridden by tests. | 165 // overridden by tests. |
166 virtual bool StoreSeed(const std::string& seed_data, | 166 virtual bool StoreSeed(const std::string& seed_data, |
167 const std::string& seed_signature, | 167 const std::string& seed_signature, |
168 const std::string& country_code, | 168 const std::string& country_code, |
169 const base::Time& date_fetched, | 169 const base::Time& date_fetched, |
170 bool is_delta_compressed); | 170 bool is_delta_compressed, |
| 171 bool is_gzip_compressed); |
171 | 172 |
172 // Creates the VariationsService with the given |local_state| prefs service | 173 // Creates the VariationsService with the given |local_state| prefs service |
173 // and |state_manager|. Does not take ownership of |state_manager|. Caller | 174 // and |state_manager|. Does not take ownership of |state_manager|. Caller |
174 // should ensure that |state_manager| is valid for the lifetime of this class. | 175 // should ensure that |state_manager| is valid for the lifetime of this class. |
175 // Use the |Create| factory method to create a VariationsService. | 176 // Use the |Create| factory method to create a VariationsService. |
176 VariationsService( | 177 VariationsService( |
177 scoped_ptr<VariationsServiceClient> client, | 178 scoped_ptr<VariationsServiceClient> client, |
178 scoped_ptr<web_resource::ResourceRequestAllowedNotifier> notifier, | 179 scoped_ptr<web_resource::ResourceRequestAllowedNotifier> notifier, |
179 PrefService* local_state, | 180 PrefService* local_state, |
180 metrics::MetricsStateManager* state_manager, | 181 metrics::MetricsStateManager* state_manager, |
181 const UIStringOverrider& ui_string_overrider); | 182 const UIStringOverrider& ui_string_overrider); |
182 | 183 |
183 private: | 184 private: |
184 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, Observer); | 185 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, Observer); |
185 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedStoredWhenOKStatus); | 186 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedStoredWhenOKStatus); |
186 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedNotStoredWhenNonOKStatus); | 187 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedNotStoredWhenNonOKStatus); |
| 188 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, RequestGzipCompressedSeed); |
| 189 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, InstanceManipulations); |
187 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedDateUpdatedOn304Status); | 190 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, SeedDateUpdatedOn304Status); |
188 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, | 191 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, |
189 LoadPermanentConsistencyCountry); | 192 LoadPermanentConsistencyCountry); |
190 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CountryHeader); | 193 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CountryHeader); |
191 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, GetVariationsServerURL); | 194 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, GetVariationsServerURL); |
192 | 195 |
193 // Set of different possible values to report for the | 196 // Set of different possible values to report for the |
194 // Variations.LoadPermanentConsistencyCountryResult histogram. This enum must | 197 // Variations.LoadPermanentConsistencyCountryResult histogram. This enum must |
195 // be kept consistent with its counterpart in histograms.xml. | 198 // be kept consistent with its counterpart in histograms.xml. |
196 enum LoadPermanentConsistencyCountryResult { | 199 enum LoadPermanentConsistencyCountryResult { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 base::ThreadChecker thread_checker_; | 309 base::ThreadChecker thread_checker_; |
307 | 310 |
308 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; | 311 base::WeakPtrFactory<VariationsService> weak_ptr_factory_; |
309 | 312 |
310 DISALLOW_COPY_AND_ASSIGN(VariationsService); | 313 DISALLOW_COPY_AND_ASSIGN(VariationsService); |
311 }; | 314 }; |
312 | 315 |
313 } // namespace variations | 316 } // namespace variations |
314 | 317 |
315 #endif // COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ | 318 #endif // COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_H_ |
OLD | NEW |