| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const CommandLine& command_line, | 75 const CommandLine& command_line, |
| 76 const PrefService* prefs) { | 76 const PrefService* prefs) { |
| 77 Availability incognito_avail = GetAvailability(prefs); | 77 Availability incognito_avail = GetAvailability(prefs); |
| 78 return incognito_avail != IncognitoModePrefs::DISABLED && | 78 return incognito_avail != IncognitoModePrefs::DISABLED && |
| 79 (command_line.HasSwitch(switches::kIncognito) || | 79 (command_line.HasSwitch(switches::kIncognito) || |
| 80 incognito_avail == IncognitoModePrefs::FORCED); | 80 incognito_avail == IncognitoModePrefs::FORCED); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // static | 83 // static |
| 84 bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) { | 84 bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) { |
| 85 if (profile->IsGuestSession()) |
| 86 return true; |
| 87 |
| 85 switch (GetAvailability(profile->GetPrefs())) { | 88 switch (GetAvailability(profile->GetPrefs())) { |
| 86 case IncognitoModePrefs::ENABLED: | 89 case IncognitoModePrefs::ENABLED: |
| 87 return true; | 90 return true; |
| 88 | 91 |
| 89 case IncognitoModePrefs::DISABLED: | 92 case IncognitoModePrefs::DISABLED: |
| 90 return !profile->IsOffTheRecord(); | 93 return !profile->IsOffTheRecord(); |
| 91 | 94 |
| 92 case IncognitoModePrefs::FORCED: | 95 case IncognitoModePrefs::FORCED: |
| 93 return profile->IsOffTheRecord(); | 96 return profile->IsOffTheRecord(); |
| 94 | 97 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 120 bool IncognitoModePrefs::ArePlatformParentalControlsEnabledCached() { | 123 bool IncognitoModePrefs::ArePlatformParentalControlsEnabledCached() { |
| 121 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
| 122 return g_parental_control_on; | 125 return g_parental_control_on; |
| 123 #elif defined(OS_ANDROID) | 126 #elif defined(OS_ANDROID) |
| 124 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); | 127 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); |
| 125 #else | 128 #else |
| 126 return false; | 129 return false; |
| 127 #endif | 130 #endif |
| 128 } | 131 } |
| 129 | 132 |
| OLD | NEW |