| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ |
| 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "chrome/browser/policy/cloud_policy_constants.h" | 19 #include "chrome/browser/policy/cloud_policy_constants.h" |
| 20 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 20 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 21 #include "content/public/common/url_fetcher_delegate.h" | 21 #include "content/public/common/url_fetcher_delegate.h" |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace policy { | 27 namespace policy { |
| 28 | 28 |
| 29 class DeviceManagementBackend; | |
| 30 class DeviceManagementRequestJobImpl; | 29 class DeviceManagementRequestJobImpl; |
| 31 class DeviceManagementService; | 30 class DeviceManagementService; |
| 32 | 31 |
| 33 // DeviceManagementRequestJob describes a request to send to the device | 32 // DeviceManagementRequestJob describes a request to send to the device |
| 34 // management service. Jobs are created by DeviceManagementService. They can be | 33 // management service. Jobs are created by DeviceManagementService. They can be |
| 35 // canceled by deleting the object. | 34 // canceled by deleting the object. |
| 36 class DeviceManagementRequestJob { | 35 class DeviceManagementRequestJob { |
| 37 public: | 36 public: |
| 38 // Describes the job type. | 37 // Describes the job type. |
| 39 enum JobType { | 38 enum JobType { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 84 |
| 86 // The device management service is responsible for everything related to | 85 // The device management service is responsible for everything related to |
| 87 // communication with the device management server. It creates the backends | 86 // communication with the device management server. It creates the backends |
| 88 // objects that the device management policy provider and friends use to issue | 87 // objects that the device management policy provider and friends use to issue |
| 89 // requests. | 88 // requests. |
| 90 class DeviceManagementService : public content::URLFetcherDelegate { | 89 class DeviceManagementService : public content::URLFetcherDelegate { |
| 91 public: | 90 public: |
| 92 explicit DeviceManagementService(const std::string& server_url); | 91 explicit DeviceManagementService(const std::string& server_url); |
| 93 virtual ~DeviceManagementService(); | 92 virtual ~DeviceManagementService(); |
| 94 | 93 |
| 95 // Constructs a device management backend for use by client code. Ownership of | |
| 96 // the returned backend object is transferred to the caller. | |
| 97 // Marked virtual for the benefit of tests. | |
| 98 // TODO(mnissler): This is deprecated, remove. Use CreateJob() instead. | |
| 99 virtual DeviceManagementBackend* CreateBackend(); | |
| 100 | |
| 101 // Creates a new device management request job. Ownership is transferred to | 94 // Creates a new device management request job. Ownership is transferred to |
| 102 // the caller. | 95 // the caller. |
| 103 virtual DeviceManagementRequestJob* CreateJob( | 96 virtual DeviceManagementRequestJob* CreateJob( |
| 104 DeviceManagementRequestJob::JobType type); | 97 DeviceManagementRequestJob::JobType type); |
| 105 | 98 |
| 106 // Schedules a task to run |Initialize| after |delay_milliseconds| had passed. | 99 // Schedules a task to run |Initialize| after |delay_milliseconds| had passed. |
| 107 void ScheduleInitialization(int64 delay_milliseconds); | 100 void ScheduleInitialization(int64 delay_milliseconds); |
| 108 | 101 |
| 109 // Makes the service stop all requests and drop the reference to the request | 102 // Makes the service stop all requests and drop the reference to the request |
| 110 // context. | 103 // context. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 146 |
| 154 // Used to create tasks to run |Initialize| delayed on the UI thread. | 147 // Used to create tasks to run |Initialize| delayed on the UI thread. |
| 155 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; | 148 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; |
| 156 | 149 |
| 157 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); | 150 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); |
| 158 }; | 151 }; |
| 159 | 152 |
| 160 } // namespace policy | 153 } // namespace policy |
| 161 | 154 |
| 162 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ | 155 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ |
| OLD | NEW |