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

Unified Diff: components/previews/previews_experiments.cc

Issue 2333003002: Changed previews component to be a layered component. (Closed)
Patch Set: Rebased on master Created 4 years, 3 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
« no previous file with comments | « components/previews/previews_experiments.h ('k') | components/previews/previews_experiments_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/previews/previews_experiments.cc
diff --git a/components/previews/previews_experiments.cc b/components/previews/previews_experiments.cc
deleted file mode 100644
index 35abce728d98247e689e9e0d1fdcf9072d672928..0000000000000000000000000000000000000000
--- a/components/previews/previews_experiments.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/previews/previews_experiments.h"
-
-#include <map>
-#include <string>
-
-#include "base/metrics/field_trial.h"
-#include "base/strings/string_util.h"
-#include "components/variations/variations_associated_data.h"
-
-namespace {
-
-// The group of client-side previews experiments.
-const char kClientSidePreviewsFieldTrial[] = "ClientSidePreviews";
-
-const char kEnabled[] = "Enabled";
-
-// Allow offline pages to show for prohibitively slow networks.
-const char kOfflinePagesSlowNetwork[] = "show_offline_pages";
-
-// The string that corresponds to enabled for the variation param experiments.
-const char kExperimentEnabled[] = "true";
-
-} // namespace
-
-namespace previews {
-
-bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() {
- // By convention, an experiment in the client-side previews study enables use
- // of at least one client-side previews optimization if its name begins with
- // "Enabled."
- return base::StartsWith(
- base::FieldTrialList::FindFullName(kClientSidePreviewsFieldTrial),
- kEnabled, base::CompareCase::SENSITIVE);
-}
-
-bool IsOfflinePreviewsEnabled() {
- if (!IsIncludedInClientSidePreviewsExperimentsFieldTrial())
- return false;
- std::map<std::string, std::string> experiment_params;
- if (!variations::GetVariationParams(kClientSidePreviewsFieldTrial,
- &experiment_params)) {
- return false;
- }
- std::map<std::string, std::string>::const_iterator it =
- experiment_params.find(kOfflinePagesSlowNetwork);
- return it != experiment_params.end() && it->second == kExperimentEnabled;
-}
-
-bool EnableOfflinePreviewsForTesting() {
- std::map<std::string, std::string> params;
- params[kOfflinePagesSlowNetwork] = kExperimentEnabled;
- return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial,
- kEnabled, params) &&
- base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial,
- kEnabled);
-}
-
-} // namespace previews
« no previous file with comments | « components/previews/previews_experiments.h ('k') | components/previews/previews_experiments_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698