Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include "chrome/browser/chromeos/login/signed_settings.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 class SignedSettings; | 13 class SignedSettings; |
| 14 | 14 |
| 15 // Helper to serialize signed settings ops, provide unified callback interface, | 15 // Helper to serialize signed settings ops, provide unified callback interface, |
| 16 // and handle callbacks destruction before ops completion. | 16 // and handle callbacks destruction before ops completion. |
| 17 class SignedSettingsHelper { | 17 class SignedSettingsHelper { |
| 18 public: | 18 public: |
| 19 class Callback { | 19 class Callback { |
| 20 public: | 20 public: |
| 21 // Callback of CheckWhitelistOp. |success| indicates whether the op succeeds | 21 // Callback of CheckWhitelistOp. |success| indicates whether the op succeeds |
| 22 // or not. |email| is the email that is checked against. | 22 // or not. |email| is the email that is checked against. |
| 23 virtual void OnCheckWhiteListCompleted( | 23 virtual void OnCheckWhitelistCompleted( |
| 24 bool success, const std::string& email) {} | 24 SignedSettings::ReturnCode code, |
| 25 bool found, | |
|
Denis Lagno
2010/12/09 11:54:12
Do we really need this "bool found"? ReturnCode c
Chris Masone
2010/12/09 16:33:42
You're probably right...SUCCESS + 'found == false'
| |
| 26 const std::string& email) {} | |
| 25 | 27 |
| 26 // Callback of WhitelistOp that adds |email| to the whitelist. | 28 // Callback of WhitelistOp that adds |email| to the whitelist. |
| 27 virtual void OnWhitelistCompleted( | 29 virtual void OnWhitelistCompleted( |
| 28 bool success, const std::string& email) {} | 30 SignedSettings::ReturnCode code, const std::string& email) {} |
| 29 | 31 |
| 30 // Callback of WhitelistOp that removes |email| to the whitelist. | 32 // Callback of WhitelistOp that removes |email| to the whitelist. |
| 31 virtual void OnUnwhitelistCompleted( | 33 virtual void OnUnwhitelistCompleted( |
| 32 bool success, const std::string& email) {} | 34 SignedSettings::ReturnCode code, const std::string& email) {} |
| 33 | 35 |
| 34 // Callback of StorePropertyOp. | 36 // Callback of StorePropertyOp. |
| 35 virtual void OnStorePropertyCompleted( | 37 virtual void OnStorePropertyCompleted( |
| 36 bool success, const std::string& name, const std::string& value) {} | 38 SignedSettings::ReturnCode code, |
| 39 const std::string& name, | |
| 40 const std::string& value) {} | |
| 37 | 41 |
| 38 // Callback of RetrievePropertyOp. | 42 // Callback of RetrievePropertyOp. |
| 39 virtual void OnRetrievePropertyCompleted( | 43 virtual void OnRetrievePropertyCompleted( |
| 40 bool success, const std::string& name, const std::string& value) {} | 44 SignedSettings::ReturnCode code, |
| 45 const std::string& name, | |
| 46 const std::string& value) {} | |
| 41 }; | 47 }; |
| 42 | 48 |
| 43 // Class factory | 49 // Class factory |
| 44 static SignedSettingsHelper* Get(); | 50 static SignedSettingsHelper* Get(); |
| 45 | 51 |
| 46 // Functions to start signed settings ops. | 52 // Functions to start signed settings ops. |
| 47 virtual void StartCheckWhitelistOp(const std::string& email, | 53 virtual void StartCheckWhitelistOp(const std::string& email, |
| 48 Callback* callback) = 0; | 54 Callback* callback) = 0; |
| 49 virtual void StartWhitelistOp(const std::string& email, | 55 virtual void StartWhitelistOp(const std::string& email, |
| 50 bool add_to_whitelist, | 56 bool add_to_whitelist, |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 74 protected: | 80 protected: |
| 75 SignedSettingsHelper() : test_delegate_(NULL) { | 81 SignedSettingsHelper() : test_delegate_(NULL) { |
| 76 } | 82 } |
| 77 | 83 |
| 78 TestDelegate* test_delegate_; | 84 TestDelegate* test_delegate_; |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 } // namespace chromeos | 87 } // namespace chromeos |
| 82 | 88 |
| 83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_HELPER_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_HELPER_H_ |
| OLD | NEW |