| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/task.h" | 14 #include "base/task.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chromeos/cros/cros_library.h" | 17 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 18 #include "chrome/browser/chromeos/cros/login_library.h" | 18 #include "chrome/browser/chromeos/cros/login_library.h" |
| 19 #include "chrome/browser/chromeos/cros/network_library.h" | 19 #include "chrome/browser/chromeos/cros/network_library.h" |
| 20 #include "chrome/browser/chromeos/cros_settings.h" | 20 #include "chrome/browser/chromeos/cros_settings.h" |
| 21 #include "chrome/browser/chromeos/cros_settings_names.h" | 21 #include "chrome/browser/chromeos/cros_settings_names.h" |
| 22 #include "chrome/browser/chromeos/login/ownership_service.h" | 22 #include "chrome/browser/chromeos/login/ownership_service.h" |
| 23 #include "chrome/browser/chromeos/login/user_manager.h" | 23 #include "chrome/browser/chromeos/login/user_manager.h" |
| 24 #include "chrome/browser/policy/browser_policy_connector.h" |
| 24 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
| 25 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 26 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 26 #include "content/browser/browser_thread.h" | 27 #include "content/browser/browser_thread.h" |
| 27 | 28 |
| 28 namespace chromeos { | 29 namespace chromeos { |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 const char kTrueIncantation[] = "true"; | 33 const char kTrueIncantation[] = "true"; |
| 33 const char kFalseIncantation[] = "false"; | 34 const char kFalseIncantation[] = "false"; |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 Value* in_value) { | 558 Value* in_value) { |
| 558 UserCrosSettingsTrust::GetInstance()->Set(path, in_value); | 559 UserCrosSettingsTrust::GetInstance()->Set(path, in_value); |
| 559 } | 560 } |
| 560 | 561 |
| 561 bool UserCrosSettingsProvider::Get(const std::string& path, | 562 bool UserCrosSettingsProvider::Get(const std::string& path, |
| 562 Value** out_value) const { | 563 Value** out_value) const { |
| 563 if (IsControlledBooleanSetting(path)) { | 564 if (IsControlledBooleanSetting(path)) { |
| 564 PrefService* prefs = g_browser_process->local_state(); | 565 PrefService* prefs = g_browser_process->local_state(); |
| 565 *out_value = CreateSettingsBooleanValue( | 566 *out_value = CreateSettingsBooleanValue( |
| 566 prefs->GetBoolean(path.c_str()), | 567 prefs->GetBoolean(path.c_str()), |
| 567 prefs->IsManagedPreference(path.c_str()), | 568 g_browser_process->browser_policy_connector()->IsEnterpriseManaged(), |
| 568 !UserManager::Get()->current_user_is_owner()); | 569 !UserManager::Get()->current_user_is_owner()); |
| 569 return true; | 570 return true; |
| 570 } else if (path == kAccountsPrefUsers) { | 571 } else if (path == kAccountsPrefUsers) { |
| 571 ListValue* user_list = new ListValue; | 572 ListValue* user_list = new ListValue; |
| 572 GetUserWhitelist(user_list); | 573 GetUserWhitelist(user_list); |
| 573 *out_value = user_list; | 574 *out_value = user_list; |
| 574 return true; | 575 return true; |
| 575 } | 576 } |
| 576 | 577 |
| 577 return false; | 578 return false; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 601 if (cached_whitelist_update->Remove(email_value) != -1) | 602 if (cached_whitelist_update->Remove(email_value) != -1) |
| 602 prefs->ScheduleSavePersistentPrefs(); | 603 prefs->ScheduleSavePersistentPrefs(); |
| 603 } | 604 } |
| 604 | 605 |
| 605 // static | 606 // static |
| 606 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { | 607 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { |
| 607 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED); | 608 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED); |
| 608 } | 609 } |
| 609 | 610 |
| 610 } // namespace chromeos | 611 } // namespace chromeos |
| OLD | NEW |