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

Unified Diff: components/offline_pages/offline_page_feature.cc

Issue 1899433002: Update flags used by offline pages and bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: components/offline_pages/offline_page_feature.cc
diff --git a/components/offline_pages/offline_page_feature.cc b/components/offline_pages/offline_page_feature.cc
index 114c0dbe9156120c27f55bed06371210918a345f..344ee462b35320c0dd6cd6d15371f64ab53ff761 100644
--- a/components/offline_pages/offline_page_feature.cc
+++ b/components/offline_pages/offline_page_feature.cc
@@ -6,90 +6,34 @@
#include <string>
-#include "base/command_line.h"
#include "base/feature_list.h"
-#include "base/metrics/field_trial.h"
-#include "base/strings/string_util.h"
-#include "build/build_config.h"
-#include "components/offline_pages/offline_page_switches.h"
-#include "components/version_info/version_info.h"
namespace offline_pages {
-namespace {
-const char kOfflinePagesFieldTrialName[] = "OfflinePages";
-// The old experiment has only one mode to enable offline pages.
-const char kEnabledGroupName[] = "Enabled";
-// The new experiment supports two modes for offline pages.
-const char kEnabledAsBookmarksGroupName[] = "EnabledAsBookmarks";
-const char kEnabledAsSavedPagesGroupName[] = "EnabledAsSavedPages";
-} // namespace
+const base::Feature kOfflineBookmarksFeature {
+ "OfflineBookmarks", base::FEATURE_DISABLED_BY_DEFAULT
+};
const base::Feature kOffliningRecentPagesFeature {
- "offline-recent-pages", base::FEATURE_DISABLED_BY_DEFAULT
+ "OfflineRecentPages", base::FEATURE_DISABLED_BY_DEFAULT
};
const base::Feature kOfflinePagesBackgroundLoadingFeature {
- "offline-pages-background-loading", base::FEATURE_DISABLED_BY_DEFAULT
+ "OfflinePagesBackgroundLoading", base::FEATURE_DISABLED_BY_DEFAULT
};
-FeatureMode GetOfflinePageFeatureMode() {
- // Note: It's important to query the field trial state first, to ensure that
- // UMA reports the correct group.
- std::string group_name =
- base::FieldTrialList::FindFullName(kOfflinePagesFieldTrialName);
-
- // The old experiment 'Enabled' defaults to showing saved page.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableOfflinePages)) {
- return FeatureMode::ENABLED_AS_SAVED_PAGES;
- }
- // The new experiment can control showing either bookmark or saved page.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableOfflinePagesAsBookmarks)) {
- return FeatureMode::ENABLED_AS_BOOKMARKS;
- }
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableOfflinePagesAsSavedPages)) {
- return FeatureMode::ENABLED_AS_SAVED_PAGES;
- }
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableOfflinePages)) {
- return FeatureMode::DISABLED;
- }
-
- // The old experiment 'Enabled' defaults to showing saved page.
- if (group_name == kEnabledGroupName)
- return FeatureMode::ENABLED_AS_SAVED_PAGES;
- // The new experiment can control showing either bookmark or saved page.
- if (base::StartsWith(group_name, kEnabledAsBookmarksGroupName,
- base::CompareCase::SENSITIVE)) {
- return FeatureMode::ENABLED_AS_BOOKMARKS;
- }
- if (base::StartsWith(group_name, kEnabledAsSavedPagesGroupName,
- base::CompareCase::SENSITIVE)) {
- return FeatureMode::ENABLED_AS_SAVED_PAGES;
- }
-
- // Enabled by default on trunk.
- return version_info::IsOfficialBuild() ? FeatureMode::DISABLED
- : FeatureMode::ENABLED_AS_BOOKMARKS;
-}
-
-bool IsOfflinePagesEnabled() {
fgorski 2016/04/18 17:09:37 As mentioned above, keep this and make it an aggre
jianli 2016/04/18 21:17:00 Done.
- FeatureMode mode = GetOfflinePageFeatureMode();
- return mode == FeatureMode::ENABLED_AS_BOOKMARKS ||
- mode == FeatureMode::ENABLED_AS_SAVED_PAGES;
+bool IsOfflineBookmarksEnabled() {
+ return base::FeatureList::IsEnabled(kOfflineBookmarksFeature);
}
bool IsOffliningRecentPagesEnabled() {
return base::FeatureList::IsEnabled(kOffliningRecentPagesFeature) &&
- IsOfflinePagesEnabled();
+ IsOfflineBookmarksEnabled();
fgorski 2016/04/18 17:09:37 No. These should be independent.
jianli 2016/04/18 21:17:00 Done.
}
bool IsOfflinePagesBackgroundLoadingEnabled() {
return base::FeatureList::IsEnabled(kOfflinePagesBackgroundLoadingFeature)
- && IsOfflinePagesEnabled();
+ && IsOfflineBookmarksEnabled();
fgorski 2016/04/18 17:09:37 ditto.
jianli 2016/04/18 21:17:00 Done.
}
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698