| 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 556 |
| 557 bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) const { | 557 bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) const { |
| 558 return ::StartsWithASCII(path, "cros.accounts.", true) || | 558 return ::StartsWithASCII(path, "cros.accounts.", true) || |
| 559 ::StartsWithASCII(path, "cros.signed.", true) || | 559 ::StartsWithASCII(path, "cros.signed.", true) || |
| 560 ::StartsWithASCII(path, "cros.metrics.", true) || | 560 ::StartsWithASCII(path, "cros.metrics.", true) || |
| 561 path == kDeviceOwner || | 561 path == kDeviceOwner || |
| 562 path == kReleaseChannel; | 562 path == kReleaseChannel; |
| 563 } | 563 } |
| 564 | 564 |
| 565 // static | 565 // static |
| 566 void UserCrosSettingsProvider::WhitelistUser(const std::string& email) { | |
| 567 SignedSettingsHelper::Get()->StartWhitelistOp( | |
| 568 email, true, UserCrosSettingsTrust::GetInstance()); | |
| 569 PrefService* prefs = g_browser_process->local_state(); | |
| 570 ListPrefUpdate cached_whitelist_update(prefs, kAccountsPrefUsers); | |
| 571 cached_whitelist_update->Append(Value::CreateStringValue(email)); | |
| 572 prefs->ScheduleSavePersistentPrefs(); | |
| 573 } | |
| 574 | |
| 575 // static | |
| 576 void UserCrosSettingsProvider::UnwhitelistUser(const std::string& email) { | |
| 577 SignedSettingsHelper::Get()->StartWhitelistOp( | |
| 578 email, false, UserCrosSettingsTrust::GetInstance()); | |
| 579 | |
| 580 PrefService* prefs = g_browser_process->local_state(); | |
| 581 ListPrefUpdate cached_whitelist_update(prefs, kAccountsPrefUsers); | |
| 582 StringValue email_value(email); | |
| 583 if (cached_whitelist_update->Remove(email_value, NULL)) | |
| 584 prefs->ScheduleSavePersistentPrefs(); | |
| 585 } | |
| 586 | |
| 587 // static | |
| 588 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { | 566 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { |
| 589 base::StringValue email_value(email); | 567 base::StringValue email_value(email); |
| 590 UpdateCache(kDeviceOwner, email_value, USE_VALUE_SUPPLIED); | 568 UpdateCache(kDeviceOwner, email_value, USE_VALUE_SUPPLIED); |
| 591 } | 569 } |
| 592 | 570 |
| 593 } // namespace chromeos | 571 } // namespace chromeos |
| OLD | NEW |