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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return NULL; | 49 return NULL; |
50 } | 50 } |
51 | 51 |
52 Profile::Delegate::~Delegate() { | 52 Profile::Delegate::~Delegate() { |
53 } | 53 } |
54 | 54 |
55 // static | 55 // static |
56 const char Profile::kProfileKey[] = "__PROFILE__"; | 56 const char Profile::kProfileKey[] = "__PROFILE__"; |
57 | 57 |
58 // static | 58 // static |
59 void Profile::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 59 void Profile::RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
60 registry->RegisterBooleanPref(prefs::kSearchSuggestEnabled, | 60 registry->RegisterBooleanPref( |
61 true, | 61 prefs::kSearchSuggestEnabled, |
62 PrefRegistrySyncable::SYNCABLE_PREF); | 62 true, |
63 registry->RegisterBooleanPref(prefs::kSessionExitedCleanly, | 63 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
64 true, | 64 registry->RegisterBooleanPref( |
65 PrefRegistrySyncable::UNSYNCABLE_PREF); | 65 prefs::kSessionExitedCleanly, |
66 registry->RegisterStringPref(prefs::kSessionExitType, | 66 true, |
67 std::string(), | 67 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
68 PrefRegistrySyncable::UNSYNCABLE_PREF); | 68 registry->RegisterStringPref( |
69 registry->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, | 69 prefs::kSessionExitType, |
70 true, | 70 std::string(), |
71 PrefRegistrySyncable::SYNCABLE_PREF); | 71 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
72 registry->RegisterBooleanPref(prefs::kSafeBrowsingReportingEnabled, | 72 registry->RegisterBooleanPref( |
73 false, | 73 prefs::kSafeBrowsingEnabled, |
74 PrefRegistrySyncable::UNSYNCABLE_PREF); | 74 true, |
75 registry->RegisterBooleanPref(prefs::kSafeBrowsingProceedAnywayDisabled, | 75 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
76 false, | 76 registry->RegisterBooleanPref( |
77 PrefRegistrySyncable::UNSYNCABLE_PREF); | 77 prefs::kSafeBrowsingReportingEnabled, |
78 registry->RegisterBooleanPref(prefs::kDisableExtensions, | 78 false, |
79 false, | 79 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
80 PrefRegistrySyncable::UNSYNCABLE_PREF); | 80 registry->RegisterBooleanPref( |
81 registry->RegisterBooleanPref(prefs::kExtensionAlertsInitializedPref, | 81 prefs::kSafeBrowsingProceedAnywayDisabled, |
82 false, PrefRegistrySyncable::UNSYNCABLE_PREF); | 82 false, |
83 registry->RegisterStringPref(prefs::kSelectFileLastDirectory, | 83 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
84 std::string(), | 84 registry->RegisterBooleanPref( |
85 PrefRegistrySyncable::UNSYNCABLE_PREF); | 85 prefs::kDisableExtensions, |
86 registry->RegisterDoublePref(prefs::kDefaultZoomLevel, | 86 false, |
87 0.0, | 87 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
88 PrefRegistrySyncable::UNSYNCABLE_PREF); | 88 registry->RegisterBooleanPref( |
89 registry->RegisterDictionaryPref(prefs::kPerHostZoomLevels, | 89 prefs::kExtensionAlertsInitializedPref, |
90 PrefRegistrySyncable::UNSYNCABLE_PREF); | 90 false, |
91 registry->RegisterStringPref(prefs::kDefaultApps, | 91 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
92 "install", | 92 registry->RegisterStringPref( |
93 PrefRegistrySyncable::UNSYNCABLE_PREF); | 93 prefs::kSelectFileLastDirectory, |
| 94 std::string(), |
| 95 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 96 registry->RegisterDoublePref( |
| 97 prefs::kDefaultZoomLevel, |
| 98 0.0, |
| 99 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 100 registry->RegisterDictionaryPref( |
| 101 prefs::kPerHostZoomLevels, |
| 102 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 103 registry->RegisterStringPref( |
| 104 prefs::kDefaultApps, |
| 105 "install", |
| 106 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
94 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
95 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both | 108 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both |
96 // local state and user's profile. For other platforms we maintain | 109 // local state and user's profile. For other platforms we maintain |
97 // kApplicationLocale only in local state. | 110 // kApplicationLocale only in local state. |
98 // In the future we may want to maintain kApplicationLocale | 111 // In the future we may want to maintain kApplicationLocale |
99 // in user's profile for other platforms as well. | 112 // in user's profile for other platforms as well. |
100 registry->RegisterStringPref(prefs::kApplicationLocale, | 113 registry->RegisterStringPref(prefs::kApplicationLocale, |
101 std::string(), | 114 std::string(), |
102 PrefRegistrySyncable::SYNCABLE_PREF); | 115 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
103 registry->RegisterStringPref(prefs::kApplicationLocaleBackup, | 116 registry->RegisterStringPref( |
104 std::string(), | 117 prefs::kApplicationLocaleBackup, |
105 PrefRegistrySyncable::UNSYNCABLE_PREF); | 118 std::string(), |
106 registry->RegisterStringPref(prefs::kApplicationLocaleAccepted, | 119 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
107 std::string(), | 120 registry->RegisterStringPref( |
108 PrefRegistrySyncable::UNSYNCABLE_PREF); | 121 prefs::kApplicationLocaleAccepted, |
| 122 std::string(), |
| 123 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
109 #endif | 124 #endif |
110 | 125 |
111 #if defined(OS_ANDROID) | 126 #if defined(OS_ANDROID) |
112 registry->RegisterBooleanPref(prefs::kDevToolsRemoteEnabled, | 127 registry->RegisterBooleanPref( |
113 false, | 128 prefs::kDevToolsRemoteEnabled, |
114 PrefRegistrySyncable::UNSYNCABLE_PREF); | 129 false, |
| 130 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
115 #endif | 131 #endif |
116 #if defined(OS_ANDROID) || defined(OS_IOS) | 132 #if defined(OS_ANDROID) || defined(OS_IOS) |
117 registry->RegisterBooleanPref(prefs::kSpdyProxyAuthEnabled, | 133 registry->RegisterBooleanPref( |
118 false, | 134 prefs::kSpdyProxyAuthEnabled, |
119 PrefRegistrySyncable::UNSYNCABLE_PREF); | 135 false, |
| 136 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
120 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 137 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
121 } | 138 } |
122 | 139 |
123 | 140 |
124 std::string Profile::GetDebugName() { | 141 std::string Profile::GetDebugName() { |
125 std::string name = GetPath().BaseName().MaybeAsASCII(); | 142 std::string name = GetPath().BaseName().MaybeAsASCII(); |
126 if (name.empty()) { | 143 if (name.empty()) { |
127 name = "UnknownProfile"; | 144 name = "UnknownProfile"; |
128 } | 145 } |
129 return name; | 146 return name; |
(...skipping 26 matching lines...) Expand all Loading... |
156 | 173 |
157 void Profile::MaybeSendDestroyedNotification() { | 174 void Profile::MaybeSendDestroyedNotification() { |
158 if (!sent_destroyed_notification_) { | 175 if (!sent_destroyed_notification_) { |
159 sent_destroyed_notification_ = true; | 176 sent_destroyed_notification_ = true; |
160 content::NotificationService::current()->Notify( | 177 content::NotificationService::current()->Notify( |
161 chrome::NOTIFICATION_PROFILE_DESTROYED, | 178 chrome::NOTIFICATION_PROFILE_DESTROYED, |
162 content::Source<Profile>(this), | 179 content::Source<Profile>(this), |
163 content::NotificationService::NoDetails()); | 180 content::NotificationService::NoDetails()); |
164 } | 181 } |
165 } | 182 } |
OLD | NEW |