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