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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 527 |
528 bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) const { | 528 bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) const { |
529 return ::StartsWithASCII(path, "cros.accounts.", true) || | 529 return ::StartsWithASCII(path, "cros.accounts.", true) || |
530 ::StartsWithASCII(path, "cros.signed.", true) || | 530 ::StartsWithASCII(path, "cros.signed.", true) || |
531 ::StartsWithASCII(path, "cros.metrics.", true) || | 531 ::StartsWithASCII(path, "cros.metrics.", true) || |
532 path == kDeviceOwner || | 532 path == kDeviceOwner || |
533 path == kReleaseChannel; | 533 path == kReleaseChannel; |
534 } | 534 } |
535 | 535 |
536 // static | 536 // static |
537 void UserCrosSettingsProvider::WhitelistUser(const std::string& email) { | |
538 SignedSettingsHelper::Get()->StartWhitelistOp( | |
539 email, true, UserCrosSettingsTrust::GetInstance()); | |
540 PrefService* prefs = g_browser_process->local_state(); | |
541 ListPrefUpdate cached_whitelist_update(prefs, kAccountsPrefUsers); | |
542 cached_whitelist_update->Append(Value::CreateStringValue(email)); | |
543 prefs->ScheduleSavePersistentPrefs(); | |
544 } | |
545 | |
546 // static | |
547 void UserCrosSettingsProvider::UnwhitelistUser(const std::string& email) { | |
548 SignedSettingsHelper::Get()->StartWhitelistOp( | |
549 email, false, UserCrosSettingsTrust::GetInstance()); | |
550 | |
551 PrefService* prefs = g_browser_process->local_state(); | |
552 ListPrefUpdate cached_whitelist_update(prefs, kAccountsPrefUsers); | |
553 StringValue email_value(email); | |
554 if (cached_whitelist_update->Remove(email_value, NULL)) | |
555 prefs->ScheduleSavePersistentPrefs(); | |
556 } | |
557 | |
558 // static | |
559 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { | 537 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { |
560 base::StringValue email_value(email); | 538 base::StringValue email_value(email); |
561 UpdateCache(kDeviceOwner, &email_value, USE_VALUE_SUPPLIED); | 539 UpdateCache(kDeviceOwner, &email_value, USE_VALUE_SUPPLIED); |
562 } | 540 } |
563 | 541 |
564 } // namespace chromeos | 542 } // namespace chromeos |
OLD | NEW |