1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_
6 #define CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_
10 #include "build/build_config.h"
12 namespace about_flags
{
14 } // namespace about_flags
19 // States for bookmark experiment. They are set by Chrome sync into
20 // sync_driver::prefs::kEnhancedBookmarksExperimentEnabled user preference and
21 // used for UMA reporting as well.
22 enum BookmarksExperimentState
{
23 BOOKMARKS_EXPERIMENT_NONE
,
24 BOOKMARKS_EXPERIMENT_ENABLED
,
25 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT
,
26 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH
,
27 BOOKMARKS_EXPERIMENT_OPT_OUT_FROM_FINCH
,
28 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH_USER_SIGNEDIN
,
29 BOOKMARKS_EXPERIMENT_ENABLED_FROM_SYNC_UNKNOWN
,
30 BOOKMARKS_EXPERIMENT_ENUM_SIZE
33 // Returns true and sets |extension_id| if bookmarks experiment enabled
34 // false if no bookmark experiment or extension id is empty.
35 bool GetBookmarksExperimentExtensionID(const PrefService
* user_prefs
,
36 std::string
* extension_id
);
38 // Updates bookmark experiment state based on information from Chrome sync,
39 // Finch experiments, and command line flag.
40 void UpdateBookmarksExperimentState(
41 PrefService
* user_prefs
,
42 PrefService
* local_state
,
44 BookmarksExperimentState experiment_enabled_from_sync
);
46 // Same as UpdateBookmarksExperimentState, but the last argument with
47 // BOOKMARKS_EXPERIMENT_ENABLED_FROM_SYNC_UNKNOWN.
48 // Intended for performing initial configuration of bookmarks experiments
49 // when the browser is first initialized.
50 void InitBookmarksExperimentState(Profile
* profile
);
52 // Sets flag to opt-in user into Finch experiment.
53 void ForceFinchBookmarkExperimentIfNeeded(
54 PrefService
* local_state
,
55 BookmarksExperimentState bookmarks_experiment_state
);
57 // Returns true if enhanced bookmarks experiment is running.
58 // Experiment could run by Chrome sync or by Finch.
59 // Note that this doesn't necessarily mean that enhanced bookmarks
60 // is enabled, e.g., user can opt out using a flag.
61 bool IsEnhancedBookmarksExperimentEnabled(
62 about_flags::FlagsStorage
* flags_storage
);
64 #if defined(OS_ANDROID)
65 // Returns true if enhanced bookmark salient image prefetching is enabled.
66 // This can be controlled by field trial.
67 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService
* user_prefs
);
69 // Returns true if enhanced bookmarks is enabled.
70 bool IsEnhancedBookmarksEnabled(const PrefService
* user_prefs
);
74 // Returns true when flag enable-dom-distiller is set or enabled from Finch.
75 bool IsEnableDomDistillerSet();
77 // Returns true when flag enable-sync-articles is set or enabled from Finch.
78 bool IsEnableSyncArticlesSet();
80 #endif // CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_