Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/policy/device_management_backend_impl.h

Issue 4098004: Implement device management backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_
7 #pragma once
8
9 #include <map>
10 #include <string>
11
12 #include "chrome/browser/policy/device_management_backend.h"
13 #include "chrome/common/net/url_fetcher.h"
14 #include "googleurl/src/gurl.h"
15
16 class URLRequestContextGetter;
17
18 namespace policy {
19
20 class ResponseHandler;
21 class URLQueryParameters;
22
23 // Device management backend implementation. This implementation makes HTTP
24 // requests to the policy server through the net layer.
25 class DeviceManagementBackendImpl : public DeviceManagementBackend,
26 public URLFetcher::Delegate {
27 public:
28 explicit DeviceManagementBackendImpl(const std::string& server_url);
29 virtual ~DeviceManagementBackendImpl();
30
31 // GoogleAppsPolicyService overrides:
32 virtual void ProcessRegisterRequest(
33 const std::string& auth_token,
34 const std::string& device_id,
35 const em::DeviceRegisterRequest& request,
36 DeviceRegisterResponseDelegate* response_delegate);
37 virtual void ProcessUnregisterRequest(
38 const std::string& device_management_token,
39 const em::DeviceUnregisterRequest& request,
40 DeviceUnregisterResponseDelegate* response_delegate);
41 virtual void ProcessPolicyRequest(
42 const std::string& device_management_token,
43 const em::DevicePolicyRequest& request,
44 DevicePolicyResponseDelegate* response_delegate);
45
46 // Get the agent string (used for HTTP user agent and as agent passed to the
47 // server).
48 static std::string GetAgentString();
49
50 private:
51 typedef std::map<const URLFetcher*, ResponseHandler*> ResponseHandlerMap;
52
53 // URLFetcher::Delegate override.
54 virtual void OnURLFetchComplete(const URLFetcher* source,
55 const GURL& url,
56 const URLRequestStatus& status,
57 int response_code,
58 const ResponseCookies& cookies,
59 const std::string& data);
60
61 // Create a URLFetcher for a given request message and response handler.
62 void CreateFetcher(const em::DeviceManagementRequest& request,
63 ResponseHandler* handler,
64 const std::string& query_params,
65 const std::string& extra_headers);
66
67 // Fill in the common query parameters.
68 void PutCommonQueryParameters(URLQueryParameters* params);
69
70 // Server at which to contact the service.
71 const std::string server_url_;
72
73 // The request context we use.
74 scoped_refptr<URLRequestContextGetter> request_context_getter_;
75
76 // Keeps track of all in-flight requests an their response handlers.
77 ResponseHandlerMap response_handlers_;
78
79 DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl);
80 };
81
82 } // namespace policy
83
84 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698