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/ui/webui/flags_ui.h" | 5 #include "chrome/browser/ui/webui/flags_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 LoadDataResourceBytesForScale(IDR_FLAGS_FAVICON, scale_factor); | 201 LoadDataResourceBytesForScale(IDR_FLAGS_FAVICON, scale_factor); |
202 } | 202 } |
203 | 203 |
204 // static | 204 // static |
205 void FlagsUI::RegisterPrefs(PrefRegistrySimple* registry) { | 205 void FlagsUI::RegisterPrefs(PrefRegistrySimple* registry) { |
206 registry->RegisterListPref(prefs::kEnabledLabsExperiments); | 206 registry->RegisterListPref(prefs::kEnabledLabsExperiments); |
207 } | 207 } |
208 | 208 |
209 #if defined(OS_CHROMEOS) | 209 #if defined(OS_CHROMEOS) |
210 // static | 210 // static |
211 void FlagsUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 211 void FlagsUI::RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
212 registry->RegisterListPref(prefs::kEnabledLabsExperiments, | 212 registry->RegisterListPref(prefs::kEnabledLabsExperiments, |
213 PrefRegistrySyncable::UNSYNCABLE_PREF); | 213 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
214 } | 214 } |
215 | 215 |
216 void FlagsUI::FinishInitialization( | 216 void FlagsUI::FinishInitialization( |
217 Profile* profile, | 217 Profile* profile, |
218 chromeos::DeviceSettingsService::OwnershipStatus status, | 218 chromeos::DeviceSettingsService::OwnershipStatus status, |
219 bool current_user_is_owner) { | 219 bool current_user_is_owner) { |
220 // On Chrome OS the owner can set system wide flags and other users can only | 220 // On Chrome OS the owner can set system wide flags and other users can only |
221 // set flags for their own session. | 221 // set flags for their own session. |
222 if (!current_user_is_owner) { | 222 if (!current_user_is_owner) { |
223 web_ui()->AddMessageHandler( | 223 web_ui()->AddMessageHandler( |
224 new FlagsDOMHandler(profile->GetPrefs(), | 224 new FlagsDOMHandler(profile->GetPrefs(), |
225 about_flags::kGeneralAccessFlagsOnly)); | 225 about_flags::kGeneralAccessFlagsOnly)); |
226 } else { | 226 } else { |
227 web_ui()->AddMessageHandler( | 227 web_ui()->AddMessageHandler( |
228 new FlagsDOMHandler(g_browser_process->local_state(), | 228 new FlagsDOMHandler(g_browser_process->local_state(), |
229 about_flags::kOwnerAccessToFlags)); | 229 about_flags::kOwnerAccessToFlags)); |
230 // If the owner managed to set the flags pref on his own profile clear it | 230 // If the owner managed to set the flags pref on his own profile clear it |
231 // because it will never be accessible anymore. | 231 // because it will never be accessible anymore. |
232 if (profile->GetPrefs()->HasPrefPath(prefs::kEnabledLabsExperiments)) | 232 if (profile->GetPrefs()->HasPrefPath(prefs::kEnabledLabsExperiments)) |
233 profile->GetPrefs()->ClearPref(prefs::kEnabledLabsExperiments); | 233 profile->GetPrefs()->ClearPref(prefs::kEnabledLabsExperiments); |
234 } | 234 } |
235 | 235 |
236 // Set up the about:flags source. | 236 // Set up the about:flags source. |
237 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); | 237 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); |
238 } | 238 } |
239 #endif | 239 #endif |
OLD | NEW |