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

Unified Diff: chrome/browser/metrics/variations_service.h

Issue 10381021: Add filtering logic for client-side variations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/variations_service.h
diff --git a/chrome/browser/metrics/variations_service.h b/chrome/browser/metrics/variations_service.h
index be9323d1d8a92f7c7933dc5d67206c48092e7944..d3ff997ebcef82bd192c7cbcee05cfc75724ca90 100644
--- a/chrome/browser/metrics/variations_service.h
+++ b/chrome/browser/metrics/variations_service.h
@@ -6,9 +6,15 @@
#define CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_
#pragma once
+#include <string>
+
#include "base/compiler_specific.h"
+#include "base/gtest_prod_util.h"
+#include "base/time.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/metrics/proto/study.pb.h"
#include "chrome/browser/metrics/proto/trials_seed.pb.h"
+#include "chrome/common/chrome_version_info.h"
#include "content/public/common/url_fetcher_delegate.h"
template <typename T> struct DefaultSingletonTraits;
@@ -40,6 +46,11 @@ class VariationsService : public content::URLFetcherDelegate {
private:
friend struct DefaultSingletonTraits<VariationsService>;
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyChannel);
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersion);
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersionWildcards);
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyDate);
+
VariationsService();
// Store the given seed data to the given local prefs. Note that |seed_data|
@@ -48,6 +59,22 @@ class VariationsService : public content::URLFetcherDelegate {
// fails, the |local_prefs| is left as is.
void StoreSeedData(const std::string& seed_data, PrefService* local_prefs);
+ // Returns whether |study| should be added to the local field trials list
+ // according to its restriction parameters.
+ static bool ShouldAddStudy(const chrome_variations::Study& study);
+
+ // Checks whether |study| is applicable for the given |channel|.
+ static bool CheckStudyChannel(const chrome_variations::Study& study,
+ chrome::VersionInfo::Channel channel);
+
+ // Checks whether |study| is applicable for the given version string.
+ static bool CheckStudyVersion(const chrome_variations::Study& study,
+ const std::string& version_string);
+
+ // Checks whether |study| is applicable for the given date/time.
+ static bool CheckStudyDate(const chrome_variations::Study& study,
+ const base::Time& date_time);
+
// Contains the current seed request. Will only have a value while a request
// is pending, and will be reset by |OnURLFetchComplete|.
scoped_ptr<content::URLFetcher> pending_seed_request_;
« no previous file with comments | « no previous file | chrome/browser/metrics/variations_service.cc » ('j') | chrome/browser/metrics/variations_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698