| 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_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 |
| 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "chrome/browser/policy/device_status_collector.h" |
| 12 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 14 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 13 | 15 |
| 14 namespace policy { | 16 namespace policy { |
| 15 | 17 |
| 16 namespace em = enterprise_management; | 18 namespace em = enterprise_management; |
| 17 | 19 |
| 18 // Stores in memory all the data that is used in the cloud policy subsystem, | 20 // Stores in memory all the data that is used in the cloud policy subsystem, |
| 19 // and manages notification about changes to these fields. | 21 // and manages notification about changes to these fields. |
| 20 // TODO(gfeher): The policy data stored in CloudPolicyCacheBase is currently | 22 // TODO(gfeher): The policy data stored in CloudPolicyCacheBase is currently |
| 21 // an exception, move that here. | 23 // an exception, move that here. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const std::string& device_id, | 75 const std::string& device_id, |
| 74 const std::string& user_name, | 76 const std::string& user_name, |
| 75 const std::string& gaia_token, | 77 const std::string& gaia_token, |
| 76 bool token_cache_loaded); | 78 bool token_cache_loaded); |
| 77 | 79 |
| 78 void set_device_id(const std::string& device_id); | 80 void set_device_id(const std::string& device_id); |
| 79 void set_machine_id(const std::string& machine_id); | 81 void set_machine_id(const std::string& machine_id); |
| 80 void set_machine_model(const std::string& machine_model); | 82 void set_machine_model(const std::string& machine_model); |
| 81 void set_user_name(const std::string& user_name); | 83 void set_user_name(const std::string& user_name); |
| 82 void set_user_affiliation(UserAffiliation user_affiliation); | 84 void set_user_affiliation(UserAffiliation user_affiliation); |
| 85 void set_device_status_collector(DeviceStatusCollector* collector); |
| 83 | 86 |
| 84 const std::string& device_id() const; | 87 const std::string& device_id() const; |
| 85 const std::string& device_token() const; | 88 const std::string& device_token() const; |
| 86 const std::string& gaia_token() const; | 89 const std::string& gaia_token() const; |
| 87 const std::string& oauth_token() const; | 90 const std::string& oauth_token() const; |
| 88 bool has_auth_token() const; | 91 bool has_auth_token() const; |
| 89 const std::string& machine_id() const; | 92 const std::string& machine_id() const; |
| 90 const std::string& machine_model() const; | 93 const std::string& machine_model() const; |
| 91 em::DeviceRegisterRequest_Type policy_register_type() const; | 94 em::DeviceRegisterRequest_Type policy_register_type() const; |
| 92 const std::string& policy_type() const; | 95 const std::string& policy_type() const; |
| 93 bool token_cache_loaded() const; | 96 bool token_cache_loaded() const; |
| 94 const std::string& user_name() const; | 97 const std::string& user_name() const; |
| 95 UserAffiliation user_affiliation() const; | 98 UserAffiliation user_affiliation() const; |
| 99 DeviceStatusCollector* device_status_collector(); |
| 96 | 100 |
| 97 void AddObserver(Observer* observer); | 101 void AddObserver(Observer* observer); |
| 98 void RemoveObserver(Observer* observer); | 102 void RemoveObserver(Observer* observer); |
| 99 | 103 |
| 100 void NotifyCredentialsChanged(); | 104 void NotifyCredentialsChanged(); |
| 101 void NotifyDeviceTokenChanged(); | 105 void NotifyDeviceTokenChanged(); |
| 102 | 106 |
| 103 private: | 107 private: |
| 104 CloudPolicyDataStore( | 108 CloudPolicyDataStore( |
| 105 const em::DeviceRegisterRequest_Type policy_register_type, | 109 const em::DeviceRegisterRequest_Type policy_register_type, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 119 const em::DeviceRegisterRequest_Type policy_register_type_; | 123 const em::DeviceRegisterRequest_Type policy_register_type_; |
| 120 const std::string policy_type_; | 124 const std::string policy_type_; |
| 121 | 125 |
| 122 // Data used for constructiong both register and policy requests. | 126 // Data used for constructiong both register and policy requests. |
| 123 std::string device_id_; | 127 std::string device_id_; |
| 124 std::string machine_model_; | 128 std::string machine_model_; |
| 125 std::string machine_id_; | 129 std::string machine_id_; |
| 126 | 130 |
| 127 bool token_cache_loaded_; | 131 bool token_cache_loaded_; |
| 128 | 132 |
| 133 scoped_ptr<DeviceStatusCollector> device_status_collector_; |
| 134 |
| 129 ObserverList<Observer, true> observer_list_; | 135 ObserverList<Observer, true> observer_list_; |
| 130 | 136 |
| 131 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore); | 137 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore); |
| 132 }; | 138 }; |
| 133 | 139 |
| 134 } // namespace policy | 140 } // namespace policy |
| 135 | 141 |
| 136 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ | 142 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ |
| OLD | NEW |