1 // Copyright (c) 2012 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 #include "chrome/browser/bookmarks/bookmark_prompt_prefs.h"
7 #include "base/prefs/pref_service.h"
8 #include "chrome/common/pref_names.h"
9 #include "components/user_prefs/pref_registry_syncable.h"
11 BookmarkPromptPrefs::BookmarkPromptPrefs(PrefService
* user_prefs
)
12 : prefs_(user_prefs
) {
15 BookmarkPromptPrefs::~BookmarkPromptPrefs() {
18 void BookmarkPromptPrefs::DisableBookmarkPrompt() {
19 prefs_
->SetBoolean(prefs::kBookmarkPromptEnabled
, false);
22 int BookmarkPromptPrefs::GetPromptImpressionCount() const {
23 return prefs_
->GetInteger(prefs::kBookmarkPromptImpressionCount
);
26 void BookmarkPromptPrefs::IncrementPromptImpressionCount() {
27 prefs_
->SetInteger(prefs::kBookmarkPromptImpressionCount
,
28 GetPromptImpressionCount() + 1);
31 bool BookmarkPromptPrefs::IsBookmarkPromptEnabled() const {
32 return prefs_
->GetBoolean(prefs::kBookmarkPromptEnabled
);
36 void BookmarkPromptPrefs::RegisterProfilePrefs(
37 user_prefs::PrefRegistrySyncable
* registry
) {
38 // We always register preferences without checking FieldTrial, because
39 // we may not receive field trial list from the server yet.
40 registry
->RegisterBooleanPref(
41 prefs::kBookmarkPromptEnabled
,
43 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF
);
44 registry
->RegisterIntegerPref(
45 prefs::kBookmarkPromptImpressionCount
,
47 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF
);