| 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 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 5 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return incognito_avail != IncognitoModePrefs::DISABLED && | 70 return incognito_avail != IncognitoModePrefs::DISABLED && |
| 71 (command_line.HasSwitch(switches::kIncognito) || | 71 (command_line.HasSwitch(switches::kIncognito) || |
| 72 incognito_avail == IncognitoModePrefs::FORCED); | 72 incognito_avail == IncognitoModePrefs::FORCED); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // static | 75 // static |
| 76 bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) { | 76 bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) { |
| 77 switch (GetAvailability(profile->GetPrefs())) { | 77 switch (GetAvailability(profile->GetPrefs())) { |
| 78 case IncognitoModePrefs::ENABLED: | 78 case IncognitoModePrefs::ENABLED: |
| 79 return true; | 79 return true; |
| 80 |
| 80 case IncognitoModePrefs::DISABLED: | 81 case IncognitoModePrefs::DISABLED: |
| 81 return !profile->IsOffTheRecord(); | 82 return !profile->IsOffTheRecord(); |
| 83 |
| 82 case IncognitoModePrefs::FORCED: | 84 case IncognitoModePrefs::FORCED: |
| 83 return profile->IsOffTheRecord(); | 85 return profile->IsOffTheRecord(); |
| 84 case IncognitoModePrefs::AVAILABILITY_NUM_TYPES: | 86 |
| 87 default: |
| 85 NOTREACHED(); | 88 NOTREACHED(); |
| 89 return false; |
| 86 } | 90 } |
| 87 NOTREACHED(); | |
| 88 return false; | |
| 89 } | 91 } |
| 90 | 92 |
| 91 // static | 93 // static |
| 92 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { | 94 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { |
| 93 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
| 94 // Disable incognito mode windows if parental controls are on. This is only | 96 // Disable incognito mode windows if parental controls are on. This is only |
| 95 // for Windows Vista and above. | 97 // for Windows Vista and above. |
| 96 return base::win::IsParentalControlActivityLoggingOn(); | 98 return base::win::IsParentalControlActivityLoggingOn(); |
| 97 #elif defined(OS_ANDROID) | 99 #elif defined(OS_ANDROID) |
| 98 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); | 100 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); |
| 101 #else |
| 102 return false; |
| 99 #endif | 103 #endif |
| 100 return false; | |
| 101 } | 104 } |
| OLD | NEW |