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