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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 LoadDataResourceBytesForScale(IDR_FLAGS_FAVICON, scale_factor); | 230 LoadDataResourceBytesForScale(IDR_FLAGS_FAVICON, scale_factor); |
231 } | 231 } |
232 | 232 |
233 // static | 233 // static |
234 void FlagsUI::RegisterPrefs(PrefRegistrySimple* registry) { | 234 void FlagsUI::RegisterPrefs(PrefRegistrySimple* registry) { |
235 registry->RegisterListPref(prefs::kEnabledLabsExperiments); | 235 registry->RegisterListPref(prefs::kEnabledLabsExperiments); |
236 } | 236 } |
237 | 237 |
238 #if defined(OS_CHROMEOS) | 238 #if defined(OS_CHROMEOS) |
239 // static | 239 // static |
240 void FlagsUI::RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry) { | 240 void FlagsUI::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
241 registry->RegisterListPref(prefs::kEnabledLabsExperiments, | 241 registry->RegisterListPref(prefs::kEnabledLabsExperiments, |
242 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 242 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
243 } | 243 } |
244 | 244 |
245 void FlagsUI::FinishInitialization( | 245 void FlagsUI::FinishInitialization( |
246 Profile* profile, | 246 Profile* profile, |
247 chromeos::DeviceSettingsService::OwnershipStatus status, | 247 chromeos::DeviceSettingsService::OwnershipStatus status, |
248 bool current_user_is_owner) { | 248 bool current_user_is_owner) { |
249 // On Chrome OS the owner can set system wide flags and other users can only | 249 // On Chrome OS the owner can set system wide flags and other users can only |
250 // set flags for their own session. | 250 // set flags for their own session. |
251 if (current_user_is_owner) { | 251 if (current_user_is_owner) { |
252 web_ui()->AddMessageHandler( | 252 web_ui()->AddMessageHandler( |
253 new FlagsDOMHandler(new chromeos::about_flags::OwnerFlagsStorage( | 253 new FlagsDOMHandler(new chromeos::about_flags::OwnerFlagsStorage( |
254 profile->GetPrefs(), | 254 profile->GetPrefs(), |
255 chromeos::CrosSettings::Get()), | 255 chromeos::CrosSettings::Get()), |
256 about_flags::kOwnerAccessToFlags)); | 256 about_flags::kOwnerAccessToFlags)); |
257 } else { | 257 } else { |
258 web_ui()->AddMessageHandler( | 258 web_ui()->AddMessageHandler( |
259 new FlagsDOMHandler(new about_flags::PrefServiceFlagsStorage( | 259 new FlagsDOMHandler(new about_flags::PrefServiceFlagsStorage( |
260 profile->GetPrefs()), | 260 profile->GetPrefs()), |
261 about_flags::kGeneralAccessFlagsOnly)); | 261 about_flags::kGeneralAccessFlagsOnly)); |
262 } | 262 } |
263 | 263 |
264 // Set up the about:flags source. | 264 // Set up the about:flags source. |
265 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); | 265 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); |
266 } | 266 } |
267 #endif | 267 #endif |
OLD | NEW |