| Index: chrome/browser/policy/device_management_backend_impl.h
|
| diff --git a/chrome/browser/policy/device_management_backend_impl.h b/chrome/browser/policy/device_management_backend_impl.h
|
| index 648ca5512df2d02d8efc254d2bd1f0fa947929e6..aa43681ae3e4474513a84819cad7c692fbce85a2 100644
|
| --- a/chrome/browser/policy/device_management_backend_impl.h
|
| +++ b/chrome/browser/policy/device_management_backend_impl.h
|
| @@ -6,29 +6,37 @@
|
| #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_
|
| #pragma once
|
|
|
| -#include <map>
|
| +#include <set>
|
| #include <string>
|
|
|
| +#include "base/basictypes.h"
|
| #include "chrome/browser/policy/device_management_backend.h"
|
| -#include "chrome/common/net/url_fetcher.h"
|
| -#include "googleurl/src/gurl.h"
|
| -
|
| -class URLRequestContextGetter;
|
|
|
| namespace policy {
|
|
|
| -class ResponseHandler;
|
| -class URLQueryParameters;
|
| +class DeviceManagementService;
|
| +class DeviceManagementJobBase;
|
|
|
| -// Device management backend implementation. This implementation makes HTTP
|
| -// requests to the policy server through the net layer.
|
| -class DeviceManagementBackendImpl : public DeviceManagementBackend,
|
| - public URLFetcher::Delegate {
|
| +// 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(const std::string& server_url);
|
| + explicit DeviceManagementBackendImpl(DeviceManagementService* service);
|
| virtual ~DeviceManagementBackendImpl();
|
|
|
| - // GoogleAppsPolicyService overrides:
|
| + 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,
|
| @@ -43,38 +51,10 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend,
|
| const em::DevicePolicyRequest& request,
|
| DevicePolicyResponseDelegate* response_delegate);
|
|
|
| - // Get the agent string (used for HTTP user agent and as agent passed to the
|
| - // server).
|
| - static std::string GetAgentString();
|
| -
|
| - private:
|
| - typedef std::map<const URLFetcher*, ResponseHandler*> ResponseHandlerMap;
|
| -
|
| - // URLFetcher::Delegate override.
|
| - virtual void OnURLFetchComplete(const URLFetcher* source,
|
| - const GURL& url,
|
| - const URLRequestStatus& status,
|
| - int response_code,
|
| - const ResponseCookies& cookies,
|
| - const std::string& data);
|
| -
|
| - // Create a URLFetcher for a given request message and response handler.
|
| - void CreateFetcher(const em::DeviceManagementRequest& request,
|
| - ResponseHandler* handler,
|
| - const std::string& query_params,
|
| - const std::string& extra_headers);
|
| -
|
| - // Fill in the common query parameters.
|
| - void PutCommonQueryParameters(URLQueryParameters* params);
|
| -
|
| - // Server at which to contact the service.
|
| - const std::string server_url_;
|
| -
|
| - // The request context we use.
|
| - scoped_refptr<URLRequestContextGetter> request_context_getter_;
|
| + // Keeps track of the jobs currently in flight.
|
| + JobSet pending_jobs_;
|
|
|
| - // Keeps track of all in-flight requests an their response handlers.
|
| - ResponseHandlerMap response_handlers_;
|
| + DeviceManagementService* service_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl);
|
| };
|
|
|