| 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; | |
| 11 class PrefService; | 10 class PrefService; |
| 12 class Profile; | 11 class Profile; |
| 13 | 12 |
| 13 namespace base { |
| 14 class CommandLine; |
| 15 } |
| 16 |
| 14 namespace user_prefs { | 17 namespace user_prefs { |
| 15 class PrefRegistrySyncable; | 18 class PrefRegistrySyncable; |
| 16 } | 19 } |
| 17 | 20 |
| 18 // Specifies Incognito mode availability preferences. | 21 // Specifies Incognito mode availability preferences. |
| 19 class IncognitoModePrefs { | 22 class IncognitoModePrefs { |
| 20 public: | 23 public: |
| 21 // Possible values for Incognito mode availability. Please, do not change | 24 // Possible values for Incognito mode availability. Please, do not change |
| 22 // the order of entries since numeric values are exposed to users. | 25 // the order of entries since numeric values are exposed to users. |
| 23 enum Availability { | 26 enum Availability { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 // value. | 48 // value. |
| 46 static void SetAvailability(PrefService* prefs, | 49 static void SetAvailability(PrefService* prefs, |
| 47 const Availability availability); | 50 const Availability availability); |
| 48 | 51 |
| 49 // Converts in_value into the corresponding Availability value. Returns true | 52 // Converts in_value into the corresponding Availability value. Returns true |
| 50 // if conversion is successful (in_value is valid). Otherwise, returns false | 53 // if conversion is successful (in_value is valid). Otherwise, returns false |
| 51 // and *out_value is set to ENABLED. | 54 // and *out_value is set to ENABLED. |
| 52 static bool IntToAvailability(int in_value, Availability* out_value); | 55 static bool IntToAvailability(int in_value, Availability* out_value); |
| 53 | 56 |
| 54 // Returns true if the browser should start in incognito mode. | 57 // Returns true if the browser should start in incognito mode. |
| 55 static bool ShouldLaunchIncognito(const CommandLine& command_line, | 58 static bool ShouldLaunchIncognito(const base::CommandLine& command_line, |
| 56 const PrefService* prefs); | 59 const PrefService* prefs); |
| 57 | 60 |
| 58 // Returns true if |profile| can open a new Browser. This checks the incognito | 61 // 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 | 62 // availability policies and verifies if the |profile| type is allowed to |
| 60 // open new windows. | 63 // open new windows. |
| 61 static bool CanOpenBrowser(Profile* profile); | 64 static bool CanOpenBrowser(Profile* profile); |
| 62 | 65 |
| 63 private: | 66 private: |
| 64 // Returns whether parental controls have been enabled on the platform, which | 67 // Returns whether parental controls have been enabled on the platform, which |
| 65 // if enabled will overrule the Availability as configured in prefs. | 68 // if enabled will overrule the Availability as configured in prefs. |
| 66 static bool ArePlatformParentalControlsEnabled(); | 69 static bool ArePlatformParentalControlsEnabled(); |
| 67 | 70 |
| 68 DISALLOW_IMPLICIT_CONSTRUCTORS(IncognitoModePrefs); | 71 DISALLOW_IMPLICIT_CONSTRUCTORS(IncognitoModePrefs); |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 #endif // CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ | 74 #endif // CHROME_BROWSER_PREFS_INCOGNITO_MODE_PREFS_H_ |
| OLD | NEW |