Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: chrome/browser/prefs/incognito_mode_prefs.cc

Issue 7520023: Converted IncognitoForced boolean policy into IncognitoModeAvailability enum policy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Converted incognito pref functions to a class. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 "chrome/browser/prefs/incognito_mode_prefs.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/common/pref_names.h"
10
11 // static
12 bool IncognitoModePrefs::IntToAvailability(
13 int in_value, Availability* out_value) {
14 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.
15 if (in_value < 0 || in_value >= AVAILABILITY_NUM_TYPES) {
16 *out_value = ENABLED;
17 return false;
18 }
19 *out_value = static_cast<Availability>(in_value);
20 return true;
21 }
22
23 // static
24 IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailability(
25 const PrefService* pref_service) {
26 DCHECK(pref_service);
27 int pref_value = pref_service->GetInteger(prefs::kIncognitoModeAvailability);
28 Availability result = IncognitoModePrefs::ENABLED;
29 bool valid = IntToAvailability(pref_value, &result);
30 DCHECK(valid);
31 return result;
32 }
33
34 // static
35 void IncognitoModePrefs::RegisterUserPrefs(PrefService* pref_service) {
36 DCHECK(pref_service);
37 pref_service->RegisterIntegerPref(prefs::kIncognitoModeAvailability,
38 IncognitoModePrefs::ENABLED,
39 PrefService::UNSYNCABLE_PREF);
40 }
41
42 IncognitoModePrefs::IncognitoModePrefs() {}
43 IncognitoModePrefs::~IncognitoModePrefs() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698