OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TOKEN_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ |
6 #define CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 CloudPolicyCache* cache); | 40 CloudPolicyCache* cache); |
41 // Version for tests that allows to set timing paramters. | 41 // Version for tests that allows to set timing paramters. |
42 DeviceTokenFetcher(DeviceManagementService* service, | 42 DeviceTokenFetcher(DeviceManagementService* service, |
43 CloudPolicyCache* cache, | 43 CloudPolicyCache* cache, |
44 int64 token_fetch_error_delay_ms, | 44 int64 token_fetch_error_delay_ms, |
45 int64 unmanaged_device_refresh_rate_ms); | 45 int64 unmanaged_device_refresh_rate_ms); |
46 virtual ~DeviceTokenFetcher(); | 46 virtual ~DeviceTokenFetcher(); |
47 | 47 |
48 // Starts fetching a token. | 48 // Starts fetching a token. |
49 void FetchToken(const std::string& auth_token, | 49 void FetchToken(const std::string& auth_token, |
50 const std::string& device_id); | 50 const std::string& device_id, |
| 51 const em::DeviceRegisterRequest_Type policy_type, |
| 52 const std::string& machine_id); |
51 | 53 |
52 // Returns the device management token or the empty string if not available. | 54 // Returns the device management token or the empty string if not available. |
53 const std::string& GetDeviceToken(); | 55 const std::string& GetDeviceToken(); |
54 | 56 |
55 void AddObserver(Observer* observer); | 57 void AddObserver(Observer* observer); |
56 void RemoveObserver(Observer* observer); | 58 void RemoveObserver(Observer* observer); |
57 | 59 |
58 // DeviceManagementBackend::DeviceRegisterResponseDelegate method overrides: | 60 // DeviceManagementBackend::DeviceRegisterResponseDelegate method overrides: |
59 virtual void HandleRegisterResponse( | 61 virtual void HandleRegisterResponse( |
60 const em::DeviceRegisterResponse& response); | 62 const em::DeviceRegisterResponse& response); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // State the fetcher is currently in. | 118 // State the fetcher is currently in. |
117 FetcherState state_; | 119 FetcherState state_; |
118 | 120 |
119 // Current device token. | 121 // Current device token. |
120 std::string device_token_; | 122 std::string device_token_; |
121 | 123 |
122 // Contains the AuthToken for the device management server. | 124 // Contains the AuthToken for the device management server. |
123 std::string auth_token_; | 125 std::string auth_token_; |
124 // Device identifier to send to the server. | 126 // Device identifier to send to the server. |
125 std::string device_id_; | 127 std::string device_id_; |
| 128 // Contains policy type to send to the server. |
| 129 em::DeviceRegisterRequest_Type policy_type_; |
| 130 // Contains physical machine id to send to the server. |
| 131 std::string machine_id_; |
126 | 132 |
127 // Task that has been scheduled to retry fetching a token. | 133 // Task that has been scheduled to retry fetching a token. |
128 CancelableTask* retry_task_; | 134 CancelableTask* retry_task_; |
129 | 135 |
130 ScopedRunnableMethodFactory<DeviceTokenFetcher> method_factory_; | 136 ScopedRunnableMethodFactory<DeviceTokenFetcher> method_factory_; |
131 | 137 |
132 ObserverList<Observer, true> observer_list_; | 138 ObserverList<Observer, true> observer_list_; |
133 }; | 139 }; |
134 | 140 |
135 } // namespace policy | 141 } // namespace policy |
136 | 142 |
137 #endif // CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ | 143 #endif // CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_ |
OLD | NEW |