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

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: Removed unnecessary comment. 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(int in_value,
13 Availability* out_value) {
14 if (in_value < 0 || in_value >= AVAILABILITY_NUM_TYPES) {
15 *out_value = ENABLED;
16 return false;
17 }
18 *out_value = static_cast<Availability>(in_value);
19 return true;
20 }
21
22 // static
23 IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailability(
24 const PrefService* pref_service) {
25 DCHECK(pref_service);
26 int pref_value = pref_service->GetInteger(prefs::kIncognitoModeAvailability);
27 Availability result = IncognitoModePrefs::ENABLED;
28 bool valid = IntToAvailability(pref_value, &result);
29 DCHECK(valid);
30 return result;
31 }
32
33 // static
34 void IncognitoModePrefs::SetAvailability(PrefService* prefs,
35 const Availability availability) {
36 prefs->SetInteger(prefs::kIncognitoModeAvailability, availability);
37 }
38
39 // static
40 void IncognitoModePrefs::RegisterUserPrefs(PrefService* pref_service) {
41 DCHECK(pref_service);
42 pref_service->RegisterIntegerPref(prefs::kIncognitoModeAvailability,
43 IncognitoModePrefs::ENABLED,
44 PrefService::UNSYNCABLE_PREF);
45 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/incognito_mode_prefs.h ('k') | chrome/browser/prefs/incognito_mode_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698