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

Side by Side Diff: components/offline_pages/offline_page_feature.cc

Issue 1772233003: Flag for Background Loading of Offline Pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put @VisibleForTesting in the right place. Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/offline_pages/offline_page_feature.h" 5 #include "components/offline_pages/offline_page_feature.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 11 matching lines...) Expand all
22 const char kEnabledGroupName[] = "Enabled"; 22 const char kEnabledGroupName[] = "Enabled";
23 // The new experiment supports two modes for offline pages. 23 // The new experiment supports two modes for offline pages.
24 const char kEnabledAsBookmarksGroupName[] = "EnabledAsBookmarks"; 24 const char kEnabledAsBookmarksGroupName[] = "EnabledAsBookmarks";
25 const char kEnabledAsSavedPagesGroupName[] = "EnabledAsSavedPages"; 25 const char kEnabledAsSavedPagesGroupName[] = "EnabledAsSavedPages";
26 } // namespace 26 } // namespace
27 27
28 const base::Feature kOffliningRecentPagesFeature { 28 const base::Feature kOffliningRecentPagesFeature {
29 "offline-recent-pages", base::FEATURE_DISABLED_BY_DEFAULT 29 "offline-recent-pages", base::FEATURE_DISABLED_BY_DEFAULT
30 }; 30 };
31 31
32 const base::Feature kOfflinePagesBackgroundLoadingFeature {
33 "offline-pages-background-loading", base::FEATURE_DISABLED_BY_DEFAULT
34 };
35
32 FeatureMode GetOfflinePageFeatureMode() { 36 FeatureMode GetOfflinePageFeatureMode() {
33 // Note: It's important to query the field trial state first, to ensure that 37 // Note: It's important to query the field trial state first, to ensure that
34 // UMA reports the correct group. 38 // UMA reports the correct group.
35 std::string group_name = 39 std::string group_name =
36 base::FieldTrialList::FindFullName(kOfflinePagesFieldTrialName); 40 base::FieldTrialList::FindFullName(kOfflinePagesFieldTrialName);
37 41
38 // The old experiment 'Enabled' defaults to showing saved page. 42 // The old experiment 'Enabled' defaults to showing saved page.
39 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 43 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
40 switches::kEnableOfflinePages)) { 44 switches::kEnableOfflinePages)) {
41 return FeatureMode::ENABLED_AS_SAVED_PAGES; 45 return FeatureMode::ENABLED_AS_SAVED_PAGES;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 FeatureMode mode = GetOfflinePageFeatureMode(); 80 FeatureMode mode = GetOfflinePageFeatureMode();
77 return mode == FeatureMode::ENABLED_AS_BOOKMARKS || 81 return mode == FeatureMode::ENABLED_AS_BOOKMARKS ||
78 mode == FeatureMode::ENABLED_AS_SAVED_PAGES; 82 mode == FeatureMode::ENABLED_AS_SAVED_PAGES;
79 } 83 }
80 84
81 bool IsOffliningRecentPagesEnabled() { 85 bool IsOffliningRecentPagesEnabled() {
82 return base::FeatureList::IsEnabled(kOffliningRecentPagesFeature) && 86 return base::FeatureList::IsEnabled(kOffliningRecentPagesFeature) &&
83 IsOfflinePagesEnabled(); 87 IsOfflinePagesEnabled();
84 } 88 }
85 89
90 bool IsOfflinePagesBackgroundLoadingEnabled() {
91 return base::FeatureList::IsEnabled(kOfflinePagesBackgroundLoadingFeature)
92 && IsOfflinePagesEnabled();
93 }
94
86 } // namespace offline_pages 95 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_feature.h ('k') | components/offline_pages/offline_page_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698