| 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_CHROMEOS_LOGIN_SIGNED_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 template <class T> | 54 template <class T> |
| 55 class Delegate { | 55 class Delegate { |
| 56 public: | 56 public: |
| 57 // This method will be called on the UI thread. | 57 // This method will be called on the UI thread. |
| 58 virtual void OnSettingsOpCompleted(ReturnCode code, T value) {} | 58 virtual void OnSettingsOpCompleted(ReturnCode code, T value) {} |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 SignedSettings(); | 61 SignedSettings(); |
| 62 virtual ~SignedSettings(); | 62 virtual ~SignedSettings(); |
| 63 | 63 |
| 64 // These are both "whitelist" operations, and only one instance of | |
| 65 // one type can be in flight at a time. | |
| 66 static SignedSettings* CreateCheckWhitelistOp( | |
| 67 const std::string& email, | |
| 68 SignedSettings::Delegate<bool>* d); | |
| 69 | |
| 70 static SignedSettings* CreateWhitelistOp(const std::string& email, | |
| 71 bool add_to_whitelist, | |
| 72 SignedSettings::Delegate<bool>* d); | |
| 73 | |
| 74 // These are both "property" operations, and only one instance of | 64 // These are both "property" operations, and only one instance of |
| 75 // one type can be in flight at a time. | 65 // one type can be in flight at a time. |
| 76 static SignedSettings* CreateStorePropertyOp( | 66 static SignedSettings* CreateStorePropertyOp( |
| 77 const std::string& name, | 67 const std::string& name, |
| 78 const base::Value& value, | 68 const base::Value& value, |
| 79 SignedSettings::Delegate<bool>* d); | 69 SignedSettings::Delegate<bool>* d); |
| 80 | 70 |
| 81 static SignedSettings* CreateRetrievePropertyOp( | 71 static SignedSettings* CreateRetrievePropertyOp( |
| 82 const std::string& name, | 72 const std::string& name, |
| 83 SignedSettings::Delegate<const base::Value&>* d); | 73 SignedSettings::Delegate<const base::Value&>* d); |
| 84 | 74 |
| 85 // These are both "policy" operations, and only one instance of | 75 // These are both "policy" operations, and only one instance of |
| 86 // one type can be in flight at a time. | 76 // one type can be in flight at a time. |
| 87 static SignedSettings* CreateStorePolicyOp( | 77 static SignedSettings* CreateStorePolicyOp( |
| 88 em::PolicyFetchResponse* policy, | 78 em::PolicyFetchResponse* policy, |
| 89 SignedSettings::Delegate<bool>* d); | 79 SignedSettings::Delegate<bool>* d); |
| 90 | 80 |
| 91 static SignedSettings* CreateRetrievePolicyOp( | 81 static SignedSettings* CreateRetrievePolicyOp( |
| 92 SignedSettings::Delegate<const em::PolicyFetchResponse&>* d); | 82 SignedSettings::Delegate<const em::PolicyFetchResponse&>* d); |
| 93 | 83 |
| 94 static bool EnumerateWhitelist(std::vector<std::string>* whitelisted); | |
| 95 | |
| 96 static ReturnCode MapKeyOpCode(OwnerManager::KeyOpCode code); | 84 static ReturnCode MapKeyOpCode(OwnerManager::KeyOpCode code); |
| 97 | 85 |
| 98 virtual void Execute() = 0; | 86 virtual void Execute() = 0; |
| 99 | 87 |
| 100 virtual void Fail(ReturnCode code) = 0; | 88 virtual void Fail(ReturnCode code) = 0; |
| 101 | 89 |
| 102 // Implementation of OwnerManager::Delegate | 90 // Implementation of OwnerManager::Delegate |
| 103 virtual void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code, | 91 virtual void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code, |
| 104 const std::vector<uint8>& payload) = 0; | 92 const std::vector<uint8>& payload) = 0; |
| 105 | 93 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 135 static const char kDevicePolicyType[]; | 123 static const char kDevicePolicyType[]; |
| 136 | 124 |
| 137 scoped_ptr<Relay> relay_; | 125 scoped_ptr<Relay> relay_; |
| 138 scoped_refptr<SignedSettings> polfetcher_; | 126 scoped_refptr<SignedSettings> polfetcher_; |
| 139 DISALLOW_COPY_AND_ASSIGN(SignedSettings); | 127 DISALLOW_COPY_AND_ASSIGN(SignedSettings); |
| 140 }; | 128 }; |
| 141 | 129 |
| 142 } // namespace chromeos | 130 } // namespace chromeos |
| 143 | 131 |
| 144 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_H_ | 132 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_H_ |
| OLD | NEW |