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/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return result; | 46 return result; |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 void IncognitoModePrefs::SetAvailability(PrefService* prefs, | 50 void IncognitoModePrefs::SetAvailability(PrefService* prefs, |
51 const Availability availability) { | 51 const Availability availability) { |
52 prefs->SetInteger(prefs::kIncognitoModeAvailability, availability); | 52 prefs->SetInteger(prefs::kIncognitoModeAvailability, availability); |
53 } | 53 } |
54 | 54 |
55 // static | 55 // static |
56 void IncognitoModePrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 56 void IncognitoModePrefs::RegisterUserPrefs( |
57 registry->RegisterIntegerPref(prefs::kIncognitoModeAvailability, | 57 user_prefs::PrefRegistrySyncable* registry) { |
58 IncognitoModePrefs::ENABLED, | 58 registry->RegisterIntegerPref( |
59 PrefRegistrySyncable::UNSYNCABLE_PREF); | 59 prefs::kIncognitoModeAvailability, |
| 60 IncognitoModePrefs::ENABLED, |
| 61 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
60 } | 62 } |
61 | 63 |
62 // static | 64 // static |
63 bool IncognitoModePrefs::ShouldLaunchIncognito( | 65 bool IncognitoModePrefs::ShouldLaunchIncognito( |
64 const CommandLine& command_line, | 66 const CommandLine& command_line, |
65 const PrefService* prefs) { | 67 const PrefService* prefs) { |
66 Availability incognito_avail = GetAvailability(prefs); | 68 Availability incognito_avail = GetAvailability(prefs); |
67 return incognito_avail != IncognitoModePrefs::DISABLED && | 69 return incognito_avail != IncognitoModePrefs::DISABLED && |
68 (command_line.HasSwitch(switches::kIncognito) || | 70 (command_line.HasSwitch(switches::kIncognito) || |
69 incognito_avail == IncognitoModePrefs::FORCED); | 71 incognito_avail == IncognitoModePrefs::FORCED); |
70 } | 72 } |
OLD | NEW |