blob: 345bc40bc6b8d0f8a505dbe2db7e1a1c2d4cf8cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright (c) 2011 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_IMPL_H_
#define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_
#pragma once
#include <set>
#include <string>
#include "base/basictypes.h"
#include "chrome/browser/policy/device_management_backend.h"
namespace policy {
class DeviceManagementService;
class DeviceManagementJobBase;
// Implements the actual backend interface. It creates device management jobs
// and passes them on to the service for processing.
class DeviceManagementBackendImpl : public DeviceManagementBackend {
public:
explicit DeviceManagementBackendImpl(DeviceManagementService* service);
virtual ~DeviceManagementBackendImpl();
static std::string GetAgentString();
// Name constants for URL query parameters.
static const char kParamRequest[];
static const char kParamDeviceType[];
static const char kParamAppType[];
static const char kParamDeviceID[];
static const char kParamAgent[];
// String constants for the device and app type we report to the server.
static const char kValueRequestRegister[];
static const char kValueRequestUnregister[];
static const char kValueRequestPolicy[];
static const char kValueDeviceType[];
static const char kValueAppType[];
private:
friend class DeviceManagementJobBase;
typedef std::set<DeviceManagementJobBase*> JobSet;
// Called by the DeviceManagementJobBase dtor so we can clean up.
void JobDone(DeviceManagementJobBase* job);
// Add a job to the pending job set and register it with the service (if
// available).
void AddJob(DeviceManagementJobBase* job);
// DeviceManagementBackend overrides.
virtual void ProcessRegisterRequest(
const std::string& auth_token,
const std::string& device_id,
const em::DeviceRegisterRequest& request,
DeviceRegisterResponseDelegate* response_delegate);
virtual void ProcessUnregisterRequest(
const std::string& device_management_token,
const std::string& device_id,
const em::DeviceUnregisterRequest& request,
DeviceUnregisterResponseDelegate* response_delegate);
virtual void ProcessPolicyRequest(
const std::string& device_management_token,
const std::string& device_id,
const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* response_delegate);
// Keeps track of the jobs currently in flight.
JobSet pending_jobs_;
DeviceManagementService* service_;
DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl);
};
} // namespace policy
#endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_
|