Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 // Notifies observers that the effective token for fetching policy | 32 // Notifies observers that the effective token for fetching policy |
| 33 // (device_token_, token_cache_loaded_) has changed. | 33 // (device_token_, token_cache_loaded_) has changed. |
| 34 virtual void OnDeviceTokenChanged() = 0; | 34 virtual void OnDeviceTokenChanged() = 0; |
| 35 | 35 |
| 36 // Authentication credentials for talking to the device management service | 36 // Authentication credentials for talking to the device management service |
| 37 // (gaia_token_) changed. | 37 // (gaia_token_) changed. |
| 38 virtual void OnCredentialsChanged() = 0; | 38 virtual void OnCredentialsChanged() = 0; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // List of modes that the device can be locked into. | |
| 42 enum DeviceMode { | |
|
Mattias Nissler (ping if slow)
2012/02/20 12:22:54
It might be a good idea to move this to cloud_poli
pastarmovj
2012/02/20 14:26:30
Done.
| |
| 43 DEVICE_MODE_CONSUMER, | |
|
Mattias Nissler (ping if slow)
2012/02/20 12:22:54
short comments on what the modes mean?
pastarmovj
2012/02/20 14:26:30
Done.
| |
| 44 DEVICE_MODE_ENTERPRISE, | |
| 45 DEVICE_MODE_KIOSK, | |
| 46 DEVICE_MODE_UNKNOWN | |
| 47 }; | |
| 48 | |
| 41 ~CloudPolicyDataStore(); | 49 ~CloudPolicyDataStore(); |
| 42 | 50 |
| 43 // Create CloudPolicyData with constants initialized for fetching user | 51 // Create CloudPolicyData with constants initialized for fetching user |
| 44 // policies. | 52 // policies. |
| 45 static CloudPolicyDataStore* CreateForUserPolicies(); | 53 static CloudPolicyDataStore* CreateForUserPolicies(); |
| 46 | 54 |
| 47 // Create CloudPolicyData with constants initialized for fetching device | 55 // Create CloudPolicyData with constants initialized for fetching device |
| 48 // policies. | 56 // policies. |
| 49 static CloudPolicyDataStore* CreateForDevicePolicies(); | 57 static CloudPolicyDataStore* CreateForDevicePolicies(); |
| 50 | 58 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 69 const std::string& user_name, | 77 const std::string& user_name, |
| 70 const std::string& gaia_token, | 78 const std::string& gaia_token, |
| 71 bool token_cache_loaded); | 79 bool token_cache_loaded); |
| 72 | 80 |
| 73 void set_device_id(const std::string& device_id); | 81 void set_device_id(const std::string& device_id); |
| 74 void set_machine_id(const std::string& machine_id); | 82 void set_machine_id(const std::string& machine_id); |
| 75 void set_machine_model(const std::string& machine_model); | 83 void set_machine_model(const std::string& machine_model); |
| 76 void set_user_name(const std::string& user_name); | 84 void set_user_name(const std::string& user_name); |
| 77 void set_user_affiliation(UserAffiliation user_affiliation); | 85 void set_user_affiliation(UserAffiliation user_affiliation); |
| 78 void set_known_machine_id(bool known_machine_id); | 86 void set_known_machine_id(bool known_machine_id); |
| 87 void set_device_mode(CloudPolicyDataStore::DeviceMode device_mode); | |
| 79 | 88 |
| 80 #if defined(OS_CHROMEOS) | 89 #if defined(OS_CHROMEOS) |
| 81 void set_device_status_collector(DeviceStatusCollector* collector); | 90 void set_device_status_collector(DeviceStatusCollector* collector); |
| 82 DeviceStatusCollector* device_status_collector(); | 91 DeviceStatusCollector* device_status_collector(); |
| 83 #endif | 92 #endif |
| 84 | 93 |
| 85 const std::string& device_id() const; | 94 const std::string& device_id() const; |
| 86 const std::string& device_token() const; | 95 const std::string& device_token() const; |
| 87 const std::string& gaia_token() const; | 96 const std::string& gaia_token() const; |
| 88 const std::string& oauth_token() const; | 97 const std::string& oauth_token() const; |
| 89 bool has_auth_token() const; | 98 bool has_auth_token() const; |
| 90 const std::string& machine_id() const; | 99 const std::string& machine_id() const; |
| 91 const std::string& machine_model() const; | 100 const std::string& machine_model() const; |
| 92 enterprise_management::DeviceRegisterRequest_Type | 101 enterprise_management::DeviceRegisterRequest_Type |
| 93 policy_register_type() const; | 102 policy_register_type() const; |
| 94 const std::string& policy_type() const; | 103 const std::string& policy_type() const; |
| 95 bool token_cache_loaded() const; | 104 bool token_cache_loaded() const; |
| 96 const std::string& user_name() const; | 105 const std::string& user_name() const; |
| 97 UserAffiliation user_affiliation() const; | 106 UserAffiliation user_affiliation() const; |
| 98 bool known_machine_id() const; | 107 bool known_machine_id() const; |
| 108 CloudPolicyDataStore::DeviceMode device_mode() const; | |
| 99 | 109 |
| 100 void AddObserver(Observer* observer); | 110 void AddObserver(Observer* observer); |
| 101 void RemoveObserver(Observer* observer); | 111 void RemoveObserver(Observer* observer); |
| 102 | 112 |
| 103 void NotifyCredentialsChanged(); | 113 void NotifyCredentialsChanged(); |
| 104 void NotifyDeviceTokenChanged(); | 114 void NotifyDeviceTokenChanged(); |
| 105 | 115 |
| 106 private: | 116 private: |
| 107 CloudPolicyDataStore( | 117 CloudPolicyDataStore( |
| 108 const enterprise_management::DeviceRegisterRequest_Type register_type, | 118 const enterprise_management::DeviceRegisterRequest_Type register_type, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 123 const std::string policy_type_; | 133 const std::string policy_type_; |
| 124 | 134 |
| 125 // Data used for constructiong both register and policy requests. | 135 // Data used for constructiong both register and policy requests. |
| 126 std::string device_id_; | 136 std::string device_id_; |
| 127 std::string machine_model_; | 137 std::string machine_model_; |
| 128 std::string machine_id_; | 138 std::string machine_id_; |
| 129 bool known_machine_id_; | 139 bool known_machine_id_; |
| 130 | 140 |
| 131 bool token_cache_loaded_; | 141 bool token_cache_loaded_; |
| 132 | 142 |
| 143 DeviceMode device_mode_; | |
| 144 | |
| 133 #if defined(OS_CHROMEOS) | 145 #if defined(OS_CHROMEOS) |
| 134 scoped_ptr<DeviceStatusCollector> device_status_collector_; | 146 scoped_ptr<DeviceStatusCollector> device_status_collector_; |
| 135 #endif | 147 #endif |
| 136 | 148 |
| 137 ObserverList<Observer, true> observer_list_; | 149 ObserverList<Observer, true> observer_list_; |
| 138 | 150 |
| 139 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore); | 151 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore); |
| 140 }; | 152 }; |
| 141 | 153 |
| 142 } // namespace policy | 154 } // namespace policy |
| 143 | 155 |
| 144 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ | 156 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ |
| OLD | NEW |