1aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo//
2aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// Copyright (C) 2014 The Android Open Source Project
3aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo//
4aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// Licensed under the Apache License, Version 2.0 (the "License");
5aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// you may not use this file except in compliance with the License.
6aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// You may obtain a copy of the License at
7aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo//
8aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo//      http://www.apache.org/licenses/LICENSE-2.0
9aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo//
10aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// Unless required by applicable law or agreed to in writing, software
11aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// distributed under the License is distributed on an "AS IS" BASIS,
12aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// See the License for the specific language governing permissions and
14aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo// limitations under the License.
15aea4c1cea20dda7ae7e85fc8924a2d784f70d806Alex Deymo//
16c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
1748415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold#ifndef UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
1848415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold#define UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
19c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
20c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo#include <set>
21c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo#include <string>
22c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
23c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo#include <base/time/time.h>
2463784a578dd26880454d70797519358a2326291bAlex Deymo#include <policy/libpolicy.h>
25c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
2663784a578dd26880454d70797519358a2326291bAlex Deymo#include "update_engine/update_manager/provider.h"
2763784a578dd26880454d70797519358a2326291bAlex Deymo#include "update_engine/update_manager/shill_provider.h"
2863784a578dd26880454d70797519358a2326291bAlex Deymo#include "update_engine/update_manager/variable.h"
29c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
3063784a578dd26880454d70797519358a2326291bAlex Deymonamespace chromeos_update_manager {
31c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
32c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo// Provides access to the current DevicePolicy.
33c83baf63f764104e9472e74f293baf0982ac0280Alex Deymoclass DevicePolicyProvider : public Provider {
34c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo public:
35610277efc6f7e5239158dfa4bb3b1021804326e0Alex Deymo  ~DevicePolicyProvider() override {}
36c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
37c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  // Variable stating whether the DevicePolicy was loaded.
38c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<bool>* var_device_policy_is_loaded() = 0;
39c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
40c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  // Variables mapping the information received on the DevicePolicy protobuf.
41c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<std::string>* var_release_channel() = 0;
42c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
43c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<bool>* var_release_channel_delegated() = 0;
44c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
45c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<bool>* var_update_disabled() = 0;
46c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
47c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<std::string>* var_target_version_prefix() = 0;
48c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
49f62a4b81b66dfcb848191efe8470646a0c986f08Gilad Arnold  // Returns a non-negative scatter interval used for updates.
50c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<base::TimeDelta>* var_scatter_factor() = 0;
51c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
52072359ca138504065e1e0c1189eb38c09576d324Alex Vakulenko  // Variable returning the set of connection types allowed for updates. The
53c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  // identifiers returned are consistent with the ones returned by the
54c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  // ShillProvider.
55255e22b82af3a52218eaea66acc734ec25cfeab6Sen Jiang  virtual Variable<std::set<chromeos_update_engine::ConnectionType>>*
56c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo      var_allowed_connection_types_for_update() = 0;
57c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
58c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  // Variable stating the name of the device owner. For enterprise enrolled
59c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  // devices, this will be an empty string.
60ef8d08712d01c23d31e27000519cbdeb88f60b73Gilad Arnold  virtual Variable<std::string>* var_owner() = 0;
61c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
62c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<bool>* var_http_downloads_enabled() = 0;
63c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
64c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  virtual Variable<bool>* var_au_p2p_enabled() = 0;
65c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
666e30bc57d672f304595e6529dd6ad0aefc3c5453Xiyuan Xia  virtual Variable<bool>* var_allow_kiosk_app_control_chrome_version() = 0;
676e30bc57d672f304595e6529dd6ad0aefc3c5453Xiyuan Xia
68c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo protected:
69c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  DevicePolicyProvider() {}
70c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
71c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo private:
72c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo  DISALLOW_COPY_AND_ASSIGN(DevicePolicyProvider);
73c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo};
74c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
7563784a578dd26880454d70797519358a2326291bAlex Deymo}  // namespace chromeos_update_manager
76c83baf63f764104e9472e74f293baf0982ac0280Alex Deymo
7748415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold#endif  // UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
78