OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
11 | 11 |
12 class PrefService; | 12 class PrefService; |
13 class Profile; | |
13 | 14 |
14 // States for bookmark experiment. They are set by Chrome sync into | 15 // States for bookmark experiment. They are set by Chrome sync into |
15 // sync_driver::prefs::kEnhancedBookmarksExperimentEnabled user preference and | 16 // sync_driver::prefs::kEnhancedBookmarksExperimentEnabled user preference and |
16 // used for UMA reporting as well. | 17 // used for UMA reporting as well. |
17 enum BookmarksExperimentState { | 18 enum BookmarksExperimentState { |
18 BOOKMARKS_EXPERIMENT_NONE, | 19 BOOKMARKS_EXPERIMENT_NONE, |
19 BOOKMARKS_EXPERIMENT_ENABLED, | 20 BOOKMARKS_EXPERIMENT_ENABLED, |
20 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT, | 21 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT, |
21 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH, | 22 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH, |
22 BOOKMARKS_EXPERIMENT_OPT_OUT_FROM_FINCH, | 23 BOOKMARKS_EXPERIMENT_OPT_OUT_FROM_FINCH, |
23 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH_USER_SIGNEDIN, | 24 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH_USER_SIGNEDIN, |
24 BOOKMARKS_EXPERIMENT_ENABLED_FROM_SYNC_UNKNOWN, | 25 BOOKMARKS_EXPERIMENT_ENABLED_FROM_SYNC_UNKNOWN, |
25 BOOKMARKS_EXPERIMENT_ENUM_SIZE | 26 BOOKMARKS_EXPERIMENT_ENUM_SIZE |
26 }; | 27 }; |
27 | 28 |
28 // Returns true and sets |extension_id| if bookmarks experiment enabled | 29 // Returns true and sets |extension_id| if bookmarks experiment enabled |
29 // false if no bookmark experiment or extension id is empty. | 30 // false if no bookmark experiment or extension id is empty. |
30 bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs, | 31 bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs, |
31 std::string* extension_id); | 32 std::string* extension_id); |
32 | 33 |
33 // Updates bookmark experiment state based on information from Chrome sync | 34 // Updates bookmark experiment state based on information from Chrome sync |
34 // and Finch experiments. | 35 // , Finch experiments, and command line flag. |
Yaron
2014/09/08 23:19:58
leading "," on previous line
Kibeom Kim (inactive)
2014/09/09 00:32:22
Done.
| |
35 void UpdateBookmarksExperimentState( | 36 void UpdateBookmarksExperimentState( |
36 PrefService* user_prefs, | 37 PrefService* user_prefs, |
37 PrefService* local_state, | 38 PrefService* local_state, |
38 bool user_signed_in, | 39 bool user_signed_in, |
39 BookmarksExperimentState experiment_enabled_from_sync); | 40 BookmarksExperimentState experiment_enabled_from_sync); |
40 | 41 |
42 // Same as UpdateBookmarksExperimentState, but the last argument with | |
43 // BOOKMARKS_EXPERIMENT_ENABLED_FROM_SYNC_UNKNOWN. | |
Yaron
2014/09/08 23:19:58
You could add: "Intended for performing initial co
Kibeom Kim (inactive)
2014/09/09 00:32:22
Done.
| |
44 void InitBookmarksExperimentState(Profile* profile); | |
45 | |
41 // Sets flag to opt-in user into Finch experiment. | 46 // Sets flag to opt-in user into Finch experiment. |
42 void ForceFinchBookmarkExperimentIfNeeded( | 47 void ForceFinchBookmarkExperimentIfNeeded( |
43 PrefService* local_state, | 48 PrefService* local_state, |
44 BookmarksExperimentState bookmarks_experiment_state); | 49 BookmarksExperimentState bookmarks_experiment_state); |
45 | 50 |
46 // Returns true if enhanced bookmarks experiment is running. | 51 // Returns true if enhanced bookmarks experiment is running. |
47 // Experiment could run by Chrome sync or by Finch. | 52 // Experiment could run by Chrome sync or by Finch. |
48 // Note that this doesn't necessarily mean that enhanced bookmarks | 53 // Note that this doesn't necessarily mean that enhanced bookmarks |
49 // is enabled, e.g., user can opt out using a flag. | 54 // is enabled, e.g., user can opt out using a flag. |
50 bool IsEnhancedBookmarksExperimentEnabled(); | 55 bool IsEnhancedBookmarksExperimentEnabled(); |
51 | 56 |
52 #if defined(OS_ANDROID) | 57 #if defined(OS_ANDROID) |
53 // Returns true if enhanced bookmark salient image prefetching is enabled. | 58 // Returns true if enhanced bookmark salient image prefetching is enabled. |
54 // This can be controlled by field trial. | 59 // This can be controlled by field trial. |
55 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs); | 60 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs); |
56 | 61 |
57 // Returns true if enhanced bookmarks is enabled. | 62 // Returns true if enhanced bookmarks is enabled. |
58 bool IsEnhancedBookmarksEnabled(const PrefService* user_prefs); | 63 bool IsEnhancedBookmarksEnabled(const PrefService* user_prefs); |
59 | 64 |
60 #endif | 65 #endif |
61 | 66 |
62 // Returns true when flag enable-dom-distiller is set or enabled from Finch. | 67 // Returns true when flag enable-dom-distiller is set or enabled from Finch. |
63 bool IsEnableDomDistillerSet(); | 68 bool IsEnableDomDistillerSet(); |
64 | 69 |
65 // Returns true when flag enable-sync-articles is set or enabled from Finch. | 70 // Returns true when flag enable-sync-articles is set or enabled from Finch. |
66 bool IsEnableSyncArticlesSet(); | 71 bool IsEnableSyncArticlesSet(); |
67 | 72 |
68 #endif // CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ | 73 #endif // CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ |
OLD | NEW |