summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy/device_management_backend.h
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-18 18:32:45 +0000
committerBen Murdoch <benm@google.com>2010-11-18 18:38:07 +0000
commit513209b27ff55e2841eac0e4120199c23acce758 (patch)
treeaeba30bb08c5f47c57003544e378a377c297eee6 /chrome/browser/policy/device_management_backend.h
parent164f7496de0fbee436b385a79ead9e3cb81a50c1 (diff)
downloadexternal_chromium-513209b27ff55e2841eac0e4120199c23acce758.zip
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.gz
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.bz2
Merge Chromium at r65505: Initial merge by git.
Change-Id: I31d8f1d8cd33caaf7f47ffa7350aef42d5fbdb45
Diffstat (limited to 'chrome/browser/policy/device_management_backend.h')
-rw-r--r--chrome/browser/policy/device_management_backend.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/chrome/browser/policy/device_management_backend.h b/chrome/browser/policy/device_management_backend.h
new file mode 100644
index 0000000..25c7b1b
--- /dev/null
+++ b/chrome/browser/policy/device_management_backend.h
@@ -0,0 +1,114 @@
+// Copyright (c) 2010 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_POLICY_DEVICE_MANAGEMENT_BACKEND_H_
+#define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/non_thread_safe.h"
+#include "chrome/browser/policy/proto/device_management_backend.pb.h"
+
+namespace policy {
+
+namespace em = enterprise_management;
+
+// Interface for clients that need to converse with the device management
+// server, which provides services to register Chrome installations and CrOS
+// devices for the purpose of fetching centrally-administered policy from the
+// cloud.
+class DeviceManagementBackend : NonThreadSafe {
+ public:
+ enum ErrorCode {
+ // Request payload invalid.
+ kErrorRequestInvalid,
+ // The HTTP request failed.
+ kErrorRequestFailed,
+ // The HTTP request returned a non-success code.
+ kErrorHttpStatus,
+ // Response could not be decoded.
+ kErrorResponseDecoding,
+ // Service error: Management not supported.
+ kErrorServiceManagementNotSupported,
+ // Service error: Device not found.
+ kErrorServiceDeviceNotFound,
+ // Service error: Device token invalid.
+ kErrorServiceManagementTokenInvalid,
+ // Service error: Activation pending.
+ kErrorServiceActivationPending,
+ };
+
+ class DeviceRegisterResponseDelegate {
+ public:
+ virtual ~DeviceRegisterResponseDelegate() {}
+ virtual void HandleRegisterResponse(
+ const em::DeviceRegisterResponse& response) = 0;
+ virtual void OnError(ErrorCode code) = 0;
+
+ protected:
+ DeviceRegisterResponseDelegate() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DeviceRegisterResponseDelegate);
+ };
+
+ class DeviceUnregisterResponseDelegate {
+ public:
+ virtual ~DeviceUnregisterResponseDelegate() {}
+ virtual void HandleUnregisterResponse(
+ const em::DeviceUnregisterResponse& response) = 0;
+ virtual void OnError(ErrorCode code) = 0;
+
+ protected:
+ DeviceUnregisterResponseDelegate() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DeviceUnregisterResponseDelegate);
+ };
+
+ class DevicePolicyResponseDelegate {
+ public:
+ virtual ~DevicePolicyResponseDelegate() {}
+
+ virtual void HandlePolicyResponse(
+ const em::DevicePolicyResponse& response) = 0;
+ virtual void OnError(ErrorCode code) = 0;
+
+ protected:
+ DevicePolicyResponseDelegate() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DevicePolicyResponseDelegate);
+ };
+
+ virtual ~DeviceManagementBackend() {}
+
+ virtual void ProcessRegisterRequest(
+ const std::string& auth_token,
+ const std::string& device_id,
+ const em::DeviceRegisterRequest& request,
+ DeviceRegisterResponseDelegate* delegate) = 0;
+
+ virtual void ProcessUnregisterRequest(
+ const std::string& device_management_token,
+ const em::DeviceUnregisterRequest& request,
+ DeviceUnregisterResponseDelegate* delegate) = 0;
+
+ virtual void ProcessPolicyRequest(
+ const std::string& device_management_token,
+ const em::DevicePolicyRequest& request,
+ DevicePolicyResponseDelegate* delegate) = 0;
+
+ protected:
+ DeviceManagementBackend() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackend);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_H_