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. 4 5 #ifndef CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ 6 #define CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ 7 8 #include <string> 9 10 #include "extensions/common/extension.h" 11 12 class PrefService; 13 14 // States for bookmark experiment. They are set by Chrome sync into 15 // sync_driver::prefs::kEnhancedBookmarksExperimentEnabled user preference and 16 // used for UMA reporting as well. 17 enum BookmarksExperimentState { 18 BOOKMARKS_EXPERIMENT_NONE, 19 BOOKMARKS_EXPERIMENT_ENABLED, 20 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT, 21 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH, 22 BOOKMARKS_EXPERIMENT_OPT_OUT_FROM_FINCH, 23 BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH_USER_SIGNEDIN, 24 BOOKMARKS_EXPERIMENT_ENABLED_FROM_SYNC_UNKNOWN, 25 BOOKMARKS_EXPERIMENT_ENUM_SIZE 26 }; 27 28 // Returns true and sets |extension_id| if bookmarks experiment enabled 29 // false if no bookmark experiment or extension id is empty. 30 bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs, 31 std::string* extension_id); 32 33 // Updates bookmark experiment state based on information from Chrome sync 34 // and Finch experiments. 35 void UpdateBookmarksExperimentState( 36 PrefService* user_prefs, 37 PrefService* local_state, 38 bool user_signed_in, 39 BookmarksExperimentState experiment_enabled_from_sync); 40 41 // Sets flag to opt-in user into Finch experiment. 42 void ForceFinchBookmarkExperimentIfNeeded( 43 PrefService* local_state, 44 BookmarksExperimentState bookmarks_experiment_state); 45 46 // Returns true if enhanced bookmarks experiment is enabled. 47 // Experiment could be enable from Chrome sync or from Finch. 48 bool IsEnhancedBookmarksExperimentEnabled(); 49 50 #if defined(OS_ANDROID) 51 bool IsEnhancedBookmarkImageFetchingEnabled(); 52 #endif 53 54 // Returns true when flag enable-dom-distiller is set or enabled from Finch. 55 bool IsEnableDomDistillerSet(); 56 57 // Returns true when flag enable-sync-articles is set or enabled from Finch. 58 bool IsEnableSyncArticlesSet(); 59 60 #endif // CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ 61