| 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_CLOUD_POLICY_DATA_STORE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const std::string& device_id, | 68 const std::string& device_id, |
| 69 const std::string& user_name, | 69 const std::string& user_name, |
| 70 const std::string& gaia_token, | 70 const std::string& gaia_token, |
| 71 bool token_cache_loaded); | 71 bool token_cache_loaded); |
| 72 | 72 |
| 73 void set_device_id(const std::string& device_id); | 73 void set_device_id(const std::string& device_id); |
| 74 void set_machine_id(const std::string& machine_id); | 74 void set_machine_id(const std::string& machine_id); |
| 75 void set_machine_model(const std::string& machine_model); | 75 void set_machine_model(const std::string& machine_model); |
| 76 void set_user_name(const std::string& user_name); | 76 void set_user_name(const std::string& user_name); |
| 77 void set_user_affiliation(UserAffiliation user_affiliation); | 77 void set_user_affiliation(UserAffiliation user_affiliation); |
| 78 void set_device_mode( |
| 79 enterprise_management::DeviceRegisterResponse_DeviceMode device_mode); |
| 78 void set_known_machine_id(bool known_machine_id); | 80 void set_known_machine_id(bool known_machine_id); |
| 79 | 81 |
| 80 #if defined(OS_CHROMEOS) | 82 #if defined(OS_CHROMEOS) |
| 81 void set_device_status_collector(DeviceStatusCollector* collector); | 83 void set_device_status_collector(DeviceStatusCollector* collector); |
| 82 DeviceStatusCollector* device_status_collector(); | 84 DeviceStatusCollector* device_status_collector(); |
| 83 #endif | 85 #endif |
| 84 | 86 |
| 85 const std::string& device_id() const; | 87 const std::string& device_id() const; |
| 86 const std::string& device_token() const; | 88 const std::string& device_token() const; |
| 87 const std::string& gaia_token() const; | 89 const std::string& gaia_token() const; |
| 88 const std::string& oauth_token() const; | 90 const std::string& oauth_token() const; |
| 89 bool has_auth_token() const; | 91 bool has_auth_token() const; |
| 90 const std::string& machine_id() const; | 92 const std::string& machine_id() const; |
| 91 const std::string& machine_model() const; | 93 const std::string& machine_model() const; |
| 92 enterprise_management::DeviceRegisterRequest_Type | 94 enterprise_management::DeviceRegisterRequest_Type |
| 93 policy_register_type() const; | 95 policy_register_type() const; |
| 94 const std::string& policy_type() const; | 96 const std::string& policy_type() const; |
| 95 bool token_cache_loaded() const; | 97 bool token_cache_loaded() const; |
| 96 const std::string& user_name() const; | 98 const std::string& user_name() const; |
| 97 UserAffiliation user_affiliation() const; | 99 UserAffiliation user_affiliation() const; |
| 100 enterprise_management::DeviceRegisterResponse_DeviceMode device_mode() const; |
| 98 bool known_machine_id() const; | 101 bool known_machine_id() const; |
| 99 | 102 |
| 100 void AddObserver(Observer* observer); | 103 void AddObserver(Observer* observer); |
| 101 void RemoveObserver(Observer* observer); | 104 void RemoveObserver(Observer* observer); |
| 102 | 105 |
| 103 void NotifyCredentialsChanged(); | 106 void NotifyCredentialsChanged(); |
| 104 void NotifyDeviceTokenChanged(); | 107 void NotifyDeviceTokenChanged(); |
| 105 | 108 |
| 106 private: | 109 private: |
| 107 CloudPolicyDataStore( | 110 CloudPolicyDataStore( |
| 108 const enterprise_management::DeviceRegisterRequest_Type register_type, | 111 const enterprise_management::DeviceRegisterRequest_Type register_type, |
| 109 const std::string& policy_type); | 112 const std::string& policy_type); |
| 110 | 113 |
| 111 // Data necessary for constructing register requests. | 114 // Data necessary for constructing register requests. |
| 112 std::string gaia_token_; | 115 std::string gaia_token_; |
| 113 std::string oauth_token_; | 116 std::string oauth_token_; |
| 114 std::string user_name_; | 117 std::string user_name_; |
| 115 | 118 |
| 116 // Data necessary for constructing policy requests. | 119 // Data necessary for constructing policy requests. |
| 117 std::string device_token_; | 120 std::string device_token_; |
| 118 UserAffiliation user_affiliation_; | 121 UserAffiliation user_affiliation_; |
| 122 enterprise_management::DeviceRegisterResponse_DeviceMode device_mode_; |
| 119 | 123 |
| 120 // Constants that won't change over the life-time of a cloud policy | 124 // Constants that won't change over the life-time of a cloud policy |
| 121 // subsystem. | 125 // subsystem. |
| 122 const enterprise_management::DeviceRegisterRequest_Type policy_register_type_; | 126 const enterprise_management::DeviceRegisterRequest_Type policy_register_type_; |
| 123 const std::string policy_type_; | 127 const std::string policy_type_; |
| 124 | 128 |
| 125 // Data used for constructiong both register and policy requests. | 129 // Data used for constructiong both register and policy requests. |
| 126 std::string device_id_; | 130 std::string device_id_; |
| 127 std::string machine_model_; | 131 std::string machine_model_; |
| 128 std::string machine_id_; | 132 std::string machine_id_; |
| 129 bool known_machine_id_; | 133 bool known_machine_id_; |
| 130 | 134 |
| 131 bool token_cache_loaded_; | 135 bool token_cache_loaded_; |
| 132 | 136 |
| 133 #if defined(OS_CHROMEOS) | 137 #if defined(OS_CHROMEOS) |
| 134 scoped_ptr<DeviceStatusCollector> device_status_collector_; | 138 scoped_ptr<DeviceStatusCollector> device_status_collector_; |
| 135 #endif | 139 #endif |
| 136 | 140 |
| 137 ObserverList<Observer, true> observer_list_; | 141 ObserverList<Observer, true> observer_list_; |
| 138 | 142 |
| 139 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore); | 143 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore); |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 } // namespace policy | 146 } // namespace policy |
| 143 | 147 |
| 144 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ | 148 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ |
| OLD | NEW |