OLD | NEW |
(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 #ifndef CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ |
| 6 #define CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 |
| 11 class PrefService; |
| 12 |
| 13 // Specifies Incognito mode availability preferences. |
| 14 class IncognitoModePrefs { |
| 15 public: |
| 16 // Possible values for Incognito mode availability. Please, do not change |
| 17 // the order of entries since numeric values are exposed to users. |
| 18 enum Availability { |
| 19 // Incognito mode enabled. Users may open pages in both Incognito mode and |
| 20 // normal mode (the default behaviour). |
| 21 ENABLED = 0, |
| 22 // Incognito mode disabled. Users may not open pages in Incognito mode. |
| 23 // Only normal mode is available for browsing. |
| 24 DISABLED, |
| 25 // Incognito mode forced. Users may open pages *ONLY* in Incognito mode. |
| 26 // Normal mode is not available for browsing. |
| 27 FORCED, |
| 28 |
| 29 AVAILABILITY_NUM_TYPES |
| 30 }; |
| 31 |
| 32 // Register incognito related preferences. |
| 33 static void RegisterUserPrefs(PrefService* prefs); |
| 34 |
| 35 // Returns kIncognitoModeAvailability preference value stored |
| 36 // in the given pref service. |
| 37 static Availability GetAvailability(const PrefService* prefs); |
| 38 |
| 39 // Sets kIncognitoModeAvailability preference to the specified availability |
| 40 // value. |
| 41 static void SetAvailability(PrefService* prefs, |
| 42 const Availability availability); |
| 43 |
| 44 // Converts in_value into the corresponding Availability value. Returns true |
| 45 // if conversion is successful (in_value is valid). Otherwise, returns false |
| 46 // and *out_value is set to ENABLED. |
| 47 static bool IntToAvailability(int in_value, Availability* out_value); |
| 48 |
| 49 private: |
| 50 DISALLOW_IMPLICIT_CONSTRUCTORS(IncognitoModePrefs); |
| 51 }; |
| 52 |
| 53 #endif // CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ |
OLD | NEW |