OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ | 5 #ifndef CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ |
6 #define CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ | 6 #define CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 class CommandLine; | 10 class CommandLine; |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Only normal mode is available for browsing. | 28 // Only normal mode is available for browsing. |
29 DISABLED, | 29 DISABLED, |
30 // Incognito mode forced. Users may open pages *ONLY* in Incognito mode. | 30 // Incognito mode forced. Users may open pages *ONLY* in Incognito mode. |
31 // Normal mode is not available for browsing. | 31 // Normal mode is not available for browsing. |
32 FORCED, | 32 FORCED, |
33 | 33 |
34 AVAILABILITY_NUM_TYPES | 34 AVAILABILITY_NUM_TYPES |
35 }; | 35 }; |
36 | 36 |
37 // Register incognito related preferences. | 37 // Register incognito related preferences. |
38 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); | 38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
39 | 39 |
40 // Returns kIncognitoModeAvailability preference value stored | 40 // Returns kIncognitoModeAvailability preference value stored |
41 // in the given pref service. | 41 // in the given pref service. |
42 static Availability GetAvailability(const PrefService* prefs); | 42 static Availability GetAvailability(const PrefService* prefs); |
43 | 43 |
44 // Sets kIncognitoModeAvailability preference to the specified availability | 44 // Sets kIncognitoModeAvailability preference to the specified availability |
45 // value. | 45 // value. |
46 static void SetAvailability(PrefService* prefs, | 46 static void SetAvailability(PrefService* prefs, |
47 const Availability availability); | 47 const Availability availability); |
48 | 48 |
49 // Converts in_value into the corresponding Availability value. Returns true | 49 // Converts in_value into the corresponding Availability value. Returns true |
50 // if conversion is successful (in_value is valid). Otherwise, returns false | 50 // if conversion is successful (in_value is valid). Otherwise, returns false |
51 // and *out_value is set to ENABLED. | 51 // and *out_value is set to ENABLED. |
52 static bool IntToAvailability(int in_value, Availability* out_value); | 52 static bool IntToAvailability(int in_value, Availability* out_value); |
53 | 53 |
54 // Returns true if the browser should start in incognito mode. | 54 // Returns true if the browser should start in incognito mode. |
55 static bool ShouldLaunchIncognito(const CommandLine& command_line, | 55 static bool ShouldLaunchIncognito(const CommandLine& command_line, |
56 const PrefService* prefs); | 56 const PrefService* prefs); |
57 | 57 |
58 // Returns true if |profile| can open a new Browser. This checks the incognito | 58 // Returns true if |profile| can open a new Browser. This checks the incognito |
59 // availability policies and verifies if the |profile| type is allowed to | 59 // availability policies and verifies if the |profile| type is allowed to |
60 // open new windows. | 60 // open new windows. |
61 static bool CanOpenBrowser(Profile* profile); | 61 static bool CanOpenBrowser(Profile* profile); |
62 | 62 |
63 private: | 63 private: |
64 DISALLOW_IMPLICIT_CONSTRUCTORS(IncognitoModePrefs); | 64 DISALLOW_IMPLICIT_CONSTRUCTORS(IncognitoModePrefs); |
65 }; | 65 }; |
66 | 66 |
67 #endif // CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ | 67 #endif // CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ |
OLD | NEW |