| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 void FlagsUI::FinishInitialization( | 213 void FlagsUI::FinishInitialization( |
| 214 Profile* profile, | 214 Profile* profile, |
| 215 chromeos::DeviceSettingsService::OwnershipStatus status, | 215 chromeos::DeviceSettingsService::OwnershipStatus status, |
| 216 bool current_user_is_owner) { | 216 bool current_user_is_owner) { |
| 217 // On Chrome OS the owner can set system wide flags and other users can only | 217 // On Chrome OS the owner can set system wide flags and other users can only |
| 218 // set flags for their own session. | 218 // set flags for their own session. |
| 219 if (!current_user_is_owner) { | 219 if (!current_user_is_owner) { |
| 220 web_ui()->AddMessageHandler(new FlagsDOMHandler(profile->GetPrefs())); | 220 web_ui()->AddMessageHandler(new FlagsDOMHandler(profile->GetPrefs())); |
| 221 } else { | 221 } else { |
| 222 web_ui()->AddMessageHandler(new FlagsDOMHandler(NULL)); | 222 web_ui()->AddMessageHandler( |
| 223 new FlagsDOMHandler(g_browser_process->local_state())); |
| 223 // If the owner managed to set the flags pref on his own profile clear it | 224 // If the owner managed to set the flags pref on his own profile clear it |
| 224 // because it will never be accessible anymore. | 225 // because it will never be accessible anymore. |
| 225 if (profile->GetPrefs()->HasPrefPath(prefs::kEnabledLabsExperiments)) | 226 if (profile->GetPrefs()->HasPrefPath(prefs::kEnabledLabsExperiments)) |
| 226 profile->GetPrefs()->ClearPref(prefs::kEnabledLabsExperiments); | 227 profile->GetPrefs()->ClearPref(prefs::kEnabledLabsExperiments); |
| 227 } | 228 } |
| 228 | 229 |
| 229 // Set up the about:flags source. | 230 // Set up the about:flags source. |
| 230 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); | 231 content::WebUIDataSource::Add(profile, CreateFlagsUIHTMLSource()); |
| 231 } | 232 } |
| 232 #endif | 233 #endif |
| OLD | NEW |