| 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 COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 // Indicates there's been an error in a previously-issued request. | 79 // Indicates there's been an error in a previously-issued request. |
| 80 virtual void OnClientError(CloudPolicyClient* client) = 0; | 80 virtual void OnClientError(CloudPolicyClient* client) = 0; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // If non-empty, |machine_id| and |machine_model| are passed to the server | 83 // If non-empty, |machine_id| and |machine_model| are passed to the server |
| 84 // verbatim. As these reveal machine identity, they must only be used where | 84 // verbatim. As these reveal machine identity, they must only be used where |
| 85 // this is appropriate (i.e. device policy, but not user policy). |service| | 85 // this is appropriate (i.e. device policy, but not user policy). |service| |
| 86 // and |signing_service| are weak pointers and it's the caller's | 86 // and |signing_service| are weak pointers and it's the caller's |
| 87 // responsibility to keep them valid for the lifetime of CloudPolicyClient. | 87 // responsibility to keep them valid for the lifetime of CloudPolicyClient. |
| 88 // |verification_key_hash| contains an identifier telling the DMServer which | 88 // The |signing_service| is used to sign sensitive requests. |
| 89 // verification key to use. The |signing_service| is used to sign sensitive | |
| 90 // requests. | |
| 91 CloudPolicyClient( | 89 CloudPolicyClient( |
| 92 const std::string& machine_id, | 90 const std::string& machine_id, |
| 93 const std::string& machine_model, | 91 const std::string& machine_model, |
| 94 const std::string& verification_key_hash, | |
| 95 DeviceManagementService* service, | 92 DeviceManagementService* service, |
| 96 scoped_refptr<net::URLRequestContextGetter> request_context, | 93 scoped_refptr<net::URLRequestContextGetter> request_context, |
| 97 SigningService* signing_service); | 94 SigningService* signing_service); |
| 98 virtual ~CloudPolicyClient(); | 95 virtual ~CloudPolicyClient(); |
| 99 | 96 |
| 100 // Sets the DMToken, thereby establishing a registration with the server. A | 97 // Sets the DMToken, thereby establishing a registration with the server. A |
| 101 // policy fetch is not automatically issued but can be requested by calling | 98 // policy fetch is not automatically issued but can be requested by calling |
| 102 // FetchPolicy(). | 99 // FetchPolicy(). |
| 103 virtual void SetupRegistration(const std::string& dm_token, | 100 virtual void SetupRegistration(const std::string& dm_token, |
| 104 const std::string& client_id); | 101 const std::string& client_id); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 367 |
| 371 // Observer notification helpers. | 368 // Observer notification helpers. |
| 372 void NotifyPolicyFetched(); | 369 void NotifyPolicyFetched(); |
| 373 void NotifyRegistrationStateChanged(); | 370 void NotifyRegistrationStateChanged(); |
| 374 void NotifyRobotAuthCodesFetched(); | 371 void NotifyRobotAuthCodesFetched(); |
| 375 void NotifyClientError(); | 372 void NotifyClientError(); |
| 376 | 373 |
| 377 // Data necessary for constructing policy requests. | 374 // Data necessary for constructing policy requests. |
| 378 const std::string machine_id_; | 375 const std::string machine_id_; |
| 379 const std::string machine_model_; | 376 const std::string machine_model_; |
| 380 const std::string verification_key_hash_; | |
| 381 PolicyTypeSet types_to_fetch_; | 377 PolicyTypeSet types_to_fetch_; |
| 382 std::vector<std::string> state_keys_to_upload_; | 378 std::vector<std::string> state_keys_to_upload_; |
| 383 | 379 |
| 384 std::string dm_token_; | 380 std::string dm_token_; |
| 385 DeviceMode device_mode_ = DEVICE_MODE_NOT_SET; | 381 DeviceMode device_mode_ = DEVICE_MODE_NOT_SET; |
| 386 std::string client_id_; | 382 std::string client_id_; |
| 387 base::Time last_policy_timestamp_; | 383 base::Time last_policy_timestamp_; |
| 388 int public_key_version_ = -1; | 384 int public_key_version_ = -1; |
| 389 bool public_key_version_valid_ = false; | 385 bool public_key_version_valid_ = false; |
| 390 std::string robot_api_auth_code_; | 386 std::string robot_api_auth_code_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 421 |
| 426 // Used to create tasks which run delayed on the UI thread. | 422 // Used to create tasks which run delayed on the UI thread. |
| 427 base::WeakPtrFactory<CloudPolicyClient> weak_ptr_factory_; | 423 base::WeakPtrFactory<CloudPolicyClient> weak_ptr_factory_; |
| 428 | 424 |
| 429 DISALLOW_COPY_AND_ASSIGN(CloudPolicyClient); | 425 DISALLOW_COPY_AND_ASSIGN(CloudPolicyClient); |
| 430 }; | 426 }; |
| 431 | 427 |
| 432 } // namespace policy | 428 } // namespace policy |
| 433 | 429 |
| 434 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ | 430 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ |
| OLD | NEW |