| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 source->AddLocalizedString("flagsNoUnsupportedExperiments", | 68 source->AddLocalizedString("flagsNoUnsupportedExperiments", |
| 69 IDS_FLAGS_NO_UNSUPPORTED_EXPERIMENTS); | 69 IDS_FLAGS_NO_UNSUPPORTED_EXPERIMENTS); |
| 70 source->AddLocalizedString("flagsNotSupported", IDS_FLAGS_NOT_AVAILABLE); | 70 source->AddLocalizedString("flagsNotSupported", IDS_FLAGS_NOT_AVAILABLE); |
| 71 source->AddLocalizedString("flagsRestartNotice", IDS_FLAGS_RELAUNCH_NOTICE); | 71 source->AddLocalizedString("flagsRestartNotice", IDS_FLAGS_RELAUNCH_NOTICE); |
| 72 source->AddLocalizedString("flagsRestartButton", IDS_FLAGS_RELAUNCH_BUTTON); | 72 source->AddLocalizedString("flagsRestartButton", IDS_FLAGS_RELAUNCH_BUTTON); |
| 73 source->AddLocalizedString("resetAllButton", IDS_FLAGS_RESET_ALL_BUTTON); | 73 source->AddLocalizedString("resetAllButton", IDS_FLAGS_RESET_ALL_BUTTON); |
| 74 source->AddLocalizedString("disable", IDS_FLAGS_DISABLE); | 74 source->AddLocalizedString("disable", IDS_FLAGS_DISABLE); |
| 75 source->AddLocalizedString("enable", IDS_FLAGS_ENABLE); | 75 source->AddLocalizedString("enable", IDS_FLAGS_ENABLE); |
| 76 | 76 |
| 77 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
| 78 if (!chromeos::UserManager::Get()->IsCurrentUserOwner() && | 78 if (!chromeos::GetUserManager()->IsCurrentUserOwner() && |
| 79 base::SysInfo::IsRunningOnChromeOS()) { | 79 base::SysInfo::IsRunningOnChromeOS()) { |
| 80 // Set the strings to show which user can actually change the flags. | 80 // Set the strings to show which user can actually change the flags. |
| 81 std::string owner; | 81 std::string owner; |
| 82 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); | 82 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
| 83 source->AddString("ownerWarning", | 83 source->AddString("ownerWarning", |
| 84 l10n_util::GetStringFUTF16(IDS_SYSTEM_FLAGS_OWNER_ONLY, | 84 l10n_util::GetStringFUTF16(IDS_SYSTEM_FLAGS_OWNER_ONLY, |
| 85 base::UTF8ToUTF16(owner))); | 85 base::UTF8ToUTF16(owner))); |
| 86 } else { | 86 } else { |
| 87 // The warning will be only shown on ChromeOS, when the current user is not | 87 // The warning will be only shown on ChromeOS, when the current user is not |
| 88 // the owner. | 88 // the owner. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // On ChromeOS be less intrusive and restart inside the user session after | 224 // On ChromeOS be less intrusive and restart inside the user session after |
| 225 // we apply the newly selected flags. | 225 // we apply the newly selected flags. |
| 226 CommandLine user_flags(CommandLine::NO_PROGRAM); | 226 CommandLine user_flags(CommandLine::NO_PROGRAM); |
| 227 about_flags::ConvertFlagsToSwitches(flags_storage_.get(), | 227 about_flags::ConvertFlagsToSwitches(flags_storage_.get(), |
| 228 &user_flags, | 228 &user_flags, |
| 229 about_flags::kAddSentinels); | 229 about_flags::kAddSentinels); |
| 230 CommandLine::StringVector flags; | 230 CommandLine::StringVector flags; |
| 231 // argv[0] is the program name |CommandLine::NO_PROGRAM|. | 231 // argv[0] is the program name |CommandLine::NO_PROGRAM|. |
| 232 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); | 232 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); |
| 233 VLOG(1) << "Restarting to apply per-session flags..."; | 233 VLOG(1) << "Restarting to apply per-session flags..."; |
| 234 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 234 chromeos::DBusThreadManager::Get() |
| 235 SetFlagsForUser(chromeos::UserManager::Get()->GetActiveUser()->email(), | 235 ->GetSessionManagerClient() |
| 236 flags); | 236 ->SetFlagsForUser(chromeos::GetUserManager()->GetActiveUser()->email(), |
| 237 flags); |
| 237 #endif | 238 #endif |
| 238 chrome::AttemptRestart(); | 239 chrome::AttemptRestart(); |
| 239 } | 240 } |
| 240 | 241 |
| 241 void FlagsDOMHandler::HandleResetAllFlags(const base::ListValue* args) { | 242 void FlagsDOMHandler::HandleResetAllFlags(const base::ListValue* args) { |
| 242 DCHECK(flags_storage_); | 243 DCHECK(flags_storage_); |
| 243 about_flags::ResetAllFlags(flags_storage_.get()); | 244 about_flags::ResetAllFlags(flags_storage_.get()); |
| 244 } | 245 } |
| 245 | 246 |
| 246 | 247 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 } | 329 } |
| 329 | 330 |
| 330 #if defined(OS_CHROMEOS) | 331 #if defined(OS_CHROMEOS) |
| 331 // static | 332 // static |
| 332 void FlagsUI::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 333 void FlagsUI::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 333 registry->RegisterListPref(prefs::kEnabledLabsExperiments, | 334 registry->RegisterListPref(prefs::kEnabledLabsExperiments, |
| 334 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 335 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 335 } | 336 } |
| 336 | 337 |
| 337 #endif | 338 #endif |
| OLD | NEW |