1// Copyright 2014 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#include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h"
6
7#include "base/prefs/pref_registry_simple.h"
8#include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h"
9#include "components/pref_registry/pref_registry_syncable.h"
10
11namespace data_reduction_proxy {
12
13// Make sure any changes here that have the potential to impact android_webview
14// are reflected in RegisterSimpleProfilePrefs.
15void RegisterSyncableProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
16  registry->RegisterBooleanPref(
17      data_reduction_proxy::prefs::kDataReductionProxyEnabled,
18      false,
19      user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
20  registry->RegisterBooleanPref(
21      data_reduction_proxy::prefs::kDataReductionProxyAltEnabled,
22      false,
23      user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
24  registry->RegisterBooleanPref(
25      data_reduction_proxy::prefs::kDataReductionProxyWasEnabledBefore,
26      false,
27      user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
28}
29
30void RegisterSimpleProfilePrefs(PrefRegistrySimple* registry) {
31  registry->RegisterBooleanPref(
32      data_reduction_proxy::prefs::kDataReductionProxyEnabled, false);
33  registry->RegisterBooleanPref(
34      data_reduction_proxy::prefs::kDataReductionProxyAltEnabled, false);
35  registry->RegisterBooleanPref(
36      data_reduction_proxy::prefs::kDataReductionProxyWasEnabledBefore, false);
37}
38
39// Add any new data reduction proxy prefs to the |pref_map_| or the
40// |list_pref_map_| in Init() of DataReductionProxyStatisticsPrefs.
41void RegisterPrefs(PrefRegistrySimple* registry) {
42  registry->RegisterInt64Pref(
43      prefs::kHttpReceivedContentLength, 0);
44  registry->RegisterInt64Pref(
45      prefs::kHttpOriginalContentLength, 0);
46  registry->RegisterListPref(
47      prefs::kDailyHttpOriginalContentLength);
48  registry->RegisterListPref(
49      prefs::kDailyHttpReceivedContentLength);
50  registry->RegisterListPref(
51      prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled);
52  registry->RegisterListPref(
53      prefs::kDailyContentLengthWithDataReductionProxyEnabled);
54  registry->RegisterListPref(
55      prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled);
56  registry->RegisterListPref(
57      prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled);
58  registry->RegisterListPref(
59      prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled);
60  registry->RegisterListPref(
61      prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled);
62  registry->RegisterListPref(
63      prefs::kDailyOriginalContentLengthViaDataReductionProxy);
64  registry->RegisterListPref(
65      prefs::kDailyContentLengthViaDataReductionProxy);
66  registry->RegisterInt64Pref(
67      prefs::kDailyHttpContentLengthLastUpdateDate, 0L);
68}
69
70}  // namespace data_reduction_proxy
71