| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/user_cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) const { | 550 bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) const { |
| 551 return ::StartsWithASCII(path, "cros.accounts.", true) || | 551 return ::StartsWithASCII(path, "cros.accounts.", true) || |
| 552 ::StartsWithASCII(path, "cros.signed.", true) || | 552 ::StartsWithASCII(path, "cros.signed.", true) || |
| 553 ::StartsWithASCII(path, "cros.metrics.", true) || | 553 ::StartsWithASCII(path, "cros.metrics.", true) || |
| 554 path == kDeviceOwner || | 554 path == kDeviceOwner || |
| 555 path == kReleaseChannel; | 555 path == kReleaseChannel; |
| 556 } | 556 } |
| 557 | 557 |
| 558 // static | 558 // static |
| 559 void UserCrosSettingsProvider::WhitelistUser(const std::string& email) { | |
| 560 SignedSettingsHelper::Get()->StartWhitelistOp( | |
| 561 email, true, UserCrosSettingsTrust::GetInstance()); | |
| 562 PrefService* prefs = g_browser_process->local_state(); | |
| 563 ListPrefUpdate cached_whitelist_update(prefs, kAccountsPrefUsers); | |
| 564 cached_whitelist_update->Append(Value::CreateStringValue(email)); | |
| 565 prefs->ScheduleSavePersistentPrefs(); | |
| 566 } | |
| 567 | |
| 568 // static | |
| 569 void UserCrosSettingsProvider::UnwhitelistUser(const std::string& email) { | |
| 570 SignedSettingsHelper::Get()->StartWhitelistOp( | |
| 571 email, false, UserCrosSettingsTrust::GetInstance()); | |
| 572 | |
| 573 PrefService* prefs = g_browser_process->local_state(); | |
| 574 ListPrefUpdate cached_whitelist_update(prefs, kAccountsPrefUsers); | |
| 575 StringValue email_value(email); | |
| 576 if (cached_whitelist_update->Remove(email_value, NULL)) | |
| 577 prefs->ScheduleSavePersistentPrefs(); | |
| 578 } | |
| 579 | |
| 580 // static | |
| 581 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { | 559 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { |
| 582 base::StringValue email_value(email); | 560 base::StringValue email_value(email); |
| 583 UpdateCache(kDeviceOwner, email_value, USE_VALUE_SUPPLIED); | 561 UpdateCache(kDeviceOwner, email_value, USE_VALUE_SUPPLIED); |
| 584 } | 562 } |
| 585 | 563 |
| 586 } // namespace chromeos | 564 } // namespace chromeos |
| OLD | NEW |