Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: chrome/browser/chromeos/login/signed_settings_helper.h

Issue 8163011: PART3: Removed whitelist special ops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on the new PART2. (I think it should be 100% the same but I'd rather upload it) Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 <string>
10 10
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/chromeos/login/signed_settings.h" 12 #include "chrome/browser/chromeos/login/signed_settings.h"
13 13
14 namespace enterprise_management { 14 namespace enterprise_management {
15 class PolicyFetchResponse; 15 class PolicyFetchResponse;
16 } // namespace enterprise_management 16 } // namespace enterprise_management
17 namespace em = enterprise_management; 17 namespace em = enterprise_management;
18 namespace chromeos { 18 namespace chromeos {
19 19
20 class SignedSettings; 20 class SignedSettings;
21 21
22 // Helper to serialize signed settings ops, provide unified callback interface, 22 // Helper to serialize signed settings ops, provide unified callback interface,
23 // and handle callbacks destruction before ops completion. 23 // and handle callbacks destruction before ops completion.
24 class SignedSettingsHelper { 24 class SignedSettingsHelper {
25 public: 25 public:
26 class Callback { 26 class Callback {
27 public: 27 public:
28 // Callback of CheckWhitelistOp. |success| indicates whether the op succeeds
29 // or not. |email| is the email that is checked against.
30 virtual void OnCheckWhitelistCompleted(
31 SignedSettings::ReturnCode code,
32 const std::string& email) {}
33
34 // Callback of WhitelistOp that adds |email| to the whitelist.
35 virtual void OnWhitelistCompleted(
36 SignedSettings::ReturnCode code, const std::string& email) {}
37
38 // Callback of WhitelistOp that removes |email| to the whitelist.
39 virtual void OnUnwhitelistCompleted(
40 SignedSettings::ReturnCode code, const std::string& email) {}
41
42 // Callback of StorePropertyOp. 28 // Callback of StorePropertyOp.
43 virtual void OnStorePropertyCompleted( 29 virtual void OnStorePropertyCompleted(
44 SignedSettings::ReturnCode code, 30 SignedSettings::ReturnCode code,
45 const std::string& name, 31 const std::string& name,
46 const base::Value& value) {} 32 const base::Value& value) {}
47 33
48 // Callback of RetrievePropertyOp. 34 // Callback of RetrievePropertyOp.
49 virtual void OnRetrievePropertyCompleted( 35 virtual void OnRetrievePropertyCompleted(
50 SignedSettings::ReturnCode code, 36 SignedSettings::ReturnCode code,
51 const std::string& name, 37 const std::string& name,
52 const base::Value& value) {} 38 const base::Value& value) {}
53 39
54 // Callback of StorePolicyOp. 40 // Callback of StorePolicyOp.
55 virtual void OnStorePolicyCompleted( 41 virtual void OnStorePolicyCompleted(
56 SignedSettings::ReturnCode code) {} 42 SignedSettings::ReturnCode code) {}
57 43
58 // Callback of RetrievePolicyOp. 44 // Callback of RetrievePolicyOp.
59 virtual void OnRetrievePolicyCompleted( 45 virtual void OnRetrievePolicyCompleted(
60 SignedSettings::ReturnCode code, 46 SignedSettings::ReturnCode code,
61 const em::PolicyFetchResponse& policy) {} 47 const em::PolicyFetchResponse& policy) {}
62 }; 48 };
63 49
64 // Class factory 50 // Class factory
65 static SignedSettingsHelper* Get(); 51 static SignedSettingsHelper* Get();
66 52
67 // Functions to start signed settings ops. 53 // Functions to start signed settings ops.
68 virtual void StartCheckWhitelistOp(const std::string& email,
69 Callback* callback) = 0;
70 virtual void StartWhitelistOp(const std::string& email,
71 bool add_to_whitelist,
72 Callback* callback) = 0;
73 virtual void StartStorePropertyOp(const std::string& name, 54 virtual void StartStorePropertyOp(const std::string& name,
74 const base::Value& value, 55 const base::Value& value,
75 Callback* callback) = 0; 56 Callback* callback) = 0;
76 virtual void StartRetrieveProperty(const std::string& name, 57 virtual void StartRetrieveProperty(const std::string& name,
77 Callback* callback) = 0; 58 Callback* callback) = 0;
78 virtual void StartStorePolicyOp(const em::PolicyFetchResponse& policy, 59 virtual void StartStorePolicyOp(const em::PolicyFetchResponse& policy,
79 Callback* callback) = 0; 60 Callback* callback) = 0;
80 virtual void StartRetrievePolicyOp(Callback* callback) = 0; 61 virtual void StartRetrievePolicyOp(Callback* callback) = 0;
81 62
82 // Cancels all pending calls of given callback. 63 // Cancels all pending calls of given callback.
(...skipping 15 matching lines...) Expand all
98 protected: 79 protected:
99 SignedSettingsHelper() : test_delegate_(NULL) { 80 SignedSettingsHelper() : test_delegate_(NULL) {
100 } 81 }
101 82
102 TestDelegate* test_delegate_; 83 TestDelegate* test_delegate_;
103 }; 84 };
104 85
105 } // namespace chromeos 86 } // namespace chromeos
106 87
107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_HELPER_H_ 88 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNED_SETTINGS_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698