Chromium Code Reviews| Index: chrome/browser/prefs/incognito_mode_prefs.cc |
| diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d1352a6933e292843c9937f43d8a986d682a23cb |
| --- /dev/null |
| +++ b/chrome/browser/prefs/incognito_mode_prefs.cc |
| @@ -0,0 +1,43 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/prefs/incognito_mode_prefs.h" |
| + |
| +#include "base/logging.h" |
| +#include "chrome/browser/prefs/pref_service.h" |
| +#include "chrome/common/pref_names.h" |
| + |
| +// static |
| +bool IncognitoModePrefs::IntToAvailability( |
| + int in_value, Availability* out_value) { |
| + DCHECK(out_value); |
|
Mattias Nissler (ping if slow)
2011/07/29 10:33:23
remove this, we'll crash anyway if out_value is NU
rustema
2011/07/30 06:17:37
Done.
|
| + if (in_value < 0 || in_value >= AVAILABILITY_NUM_TYPES) { |
| + *out_value = ENABLED; |
| + return false; |
| + } |
| + *out_value = static_cast<Availability>(in_value); |
| + return true; |
| +} |
| + |
| +// static |
| +IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailability( |
| + const PrefService* pref_service) { |
| + DCHECK(pref_service); |
| + int pref_value = pref_service->GetInteger(prefs::kIncognitoModeAvailability); |
| + Availability result = IncognitoModePrefs::ENABLED; |
| + bool valid = IntToAvailability(pref_value, &result); |
| + DCHECK(valid); |
| + return result; |
| +} |
| + |
| +// static |
| +void IncognitoModePrefs::RegisterUserPrefs(PrefService* pref_service) { |
| + DCHECK(pref_service); |
| + pref_service->RegisterIntegerPref(prefs::kIncognitoModeAvailability, |
| + IncognitoModePrefs::ENABLED, |
| + PrefService::UNSYNCABLE_PREF); |
| +} |
| + |
| +IncognitoModePrefs::IncognitoModePrefs() {} |
| +IncognitoModePrefs::~IncognitoModePrefs() {} |