| Index: chrome/browser/chromeos/policy/android_management_client.h
|
| diff --git a/chrome/browser/chromeos/policy/android_management_client.h b/chrome/browser/chromeos/policy/android_management_client.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..82e0f5642041f8bbe9242b663912fd0ea3bbf787
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/policy/android_management_client.h
|
| @@ -0,0 +1,67 @@
|
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_CHROMEOS_POLICY_ANDROID_MANAGEMENT_CLIENT_H_
|
| +#define CHROME_BROWSER_CHROMEOS_POLICY_ANDROID_MANAGEMENT_CLIENT_H_
|
| +
|
| +#include <memory>
|
| +#include <string>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "components/policy/core/common/cloud/cloud_policy_constants.h"
|
| +#include "net/url_request/url_request_context_getter.h"
|
| +
|
| +namespace enterprise_management {
|
| +class DeviceManagementResponse;
|
| +}
|
| +
|
| +namespace policy {
|
| +
|
| +class DeviceManagementRequestJob;
|
| +class DeviceManagementService;
|
| +
|
| +// Interacts with the device management service and determines whether Android
|
| +// management is enabled for the user or not.
|
| +class AndroidManagementClient {
|
| + public:
|
| + // Indicates result of the android management check.
|
| + enum Result {
|
| + RESULT_MANAGED, // Android management is enabled.
|
| + RESULT_UNMANAGED, // Android management is disabled.
|
| + RESULT_ERROR, // Received a error.
|
| + };
|
| +
|
| + // A callback which receives Result status of an operation.
|
| + using StatusCallback = base::Callback<void(Result)>;
|
| +
|
| + AndroidManagementClient(
|
| + DeviceManagementService* service,
|
| + scoped_refptr<net::URLRequestContextGetter> request_context);
|
| + ~AndroidManagementClient();
|
| +
|
| + // Sends a check Android management request to the device management service.
|
| + void CheckAndroidManagement(const std::string& auth_token,
|
| + const StatusCallback& callback);
|
| +
|
| + private:
|
| + // Callback for check Android management requests.
|
| + void OnAndroidManagementChecked(
|
| + const StatusCallback& callback,
|
| + DeviceManagementStatus status,
|
| + int net_error,
|
| + const enterprise_management::DeviceManagementResponse& response);
|
| +
|
| + // Used to communicate with the device management service.
|
| + DeviceManagementService* service_;
|
| + scoped_refptr<net::URLRequestContextGetter> request_context_;
|
| + std::unique_ptr<DeviceManagementRequestJob> request_job_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AndroidManagementClient);
|
| +};
|
| +
|
| +} // namespace policy
|
| +
|
| +#endif // CHROME_BROWSER_CHROMEOS_POLICY_ANDROID_MANAGEMENT_CLIENT_H_
|
|
|