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