system_settings_provider.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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
  3. // found in the LICENSE file.
  4. #ifndef ASH_COMPONENTS_SETTINGS_SYSTEM_SETTINGS_PROVIDER_H_
  5. #define ASH_COMPONENTS_SETTINGS_SYSTEM_SETTINGS_PROVIDER_H_
  6. #include <memory>
  7. #include <string>
  8. #include "ash/components/settings/cros_settings_provider.h"
  9. #include "ash/components/settings/timezone_settings.h"
  10. #include "base/callback.h"
  11. #include "base/component_export.h"
  12. #include "third_party/icu/source/i18n/unicode/timezone.h"
  13. namespace base {
  14. class Value;
  15. } // namespace base
  16. namespace ash {
  17. class COMPONENT_EXPORT(ASH_SETTINGS) SystemSettingsProvider
  18. : public CrosSettingsProvider,
  19. public system::TimezoneSettings::Observer {
  20. public:
  21. SystemSettingsProvider();
  22. explicit SystemSettingsProvider(const NotifyObserversCallback& notify_cb);
  23. SystemSettingsProvider(const SystemSettingsProvider&) = delete;
  24. SystemSettingsProvider& operator=(const SystemSettingsProvider&) = delete;
  25. ~SystemSettingsProvider() override;
  26. // CrosSettingsProvider implementation.
  27. const base::Value* Get(const std::string& path) const override;
  28. TrustedStatus PrepareTrustedValues(base::OnceClosure* callback) override;
  29. bool HandlesSetting(const std::string& path) const override;
  30. // TimezoneSettings::Observer implementation.
  31. void TimezoneChanged(const icu::TimeZone& timezone) override;
  32. private:
  33. // Code common to both constructors.
  34. void Init();
  35. std::unique_ptr<base::Value> timezone_value_;
  36. std::unique_ptr<base::Value> per_user_timezone_enabled_value_;
  37. std::unique_ptr<base::Value> fine_grained_time_zone_enabled_value_;
  38. };
  39. } // namespace ash
  40. // TODO(https://crbug.com/1164001): remove when the migration is finished.
  41. namespace chromeos {
  42. using ::ash::SystemSettingsProvider;
  43. } // namespace chromeos
  44. #endif // ASH_COMPONENTS_SETTINGS_SYSTEM_SETTINGS_PROVIDER_H_