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

Side by Side Diff: chrome/browser/policy/cloud_policy_data_store.h

Issue 7785032: Revert 98987 - Pass user_affiliation request parameter on user cloud policy requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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_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
(...skipping 16 matching lines...) Expand all
27 27
28 // Notifies observers that the effective token for fetching policy 28 // Notifies observers that the effective token for fetching policy
29 // (device_token_, token_cache_loaded_) has changed. 29 // (device_token_, token_cache_loaded_) has changed.
30 virtual void OnDeviceTokenChanged() = 0; 30 virtual void OnDeviceTokenChanged() = 0;
31 31
32 // Authentication credentials for talking to the device management service 32 // Authentication credentials for talking to the device management service
33 // (gaia_token_) changed. 33 // (gaia_token_) changed.
34 virtual void OnCredentialsChanged() = 0; 34 virtual void OnCredentialsChanged() = 0;
35 }; 35 };
36 36
37 // Describes the affilitation of a user w.r.t. the managed state of the
38 // device.
39 enum UserAffiliation {
40 // User is on the same domain the device was registered with.
41 USER_AFFILIATION_MANAGED,
42 // No affiliation between device and user user.
43 USER_AFFILIATION_NONE,
44 };
45
46 ~CloudPolicyDataStore(); 37 ~CloudPolicyDataStore();
47 38
48 // Create CloudPolicyData with constants initialized for fetching user 39 // Create CloudPolicyData with constants initialized for fetching user
49 // policies. 40 // policies.
50 static CloudPolicyDataStore* CreateForUserPolicies(); 41 static CloudPolicyDataStore* CreateForUserPolicies();
51 42
52 // Create CloudPolicyData with constants initialized for fetching device 43 // Create CloudPolicyData with constants initialized for fetching device
53 // policies. 44 // policies.
54 static CloudPolicyDataStore* CreateForDevicePolicies(); 45 static CloudPolicyDataStore* CreateForDevicePolicies();
55 46
(...skipping 14 matching lines...) Expand all
70 61
71 // Only used in tests. 62 // Only used in tests.
72 void SetupForTesting(const std::string& device_token, 63 void SetupForTesting(const std::string& device_token,
73 const std::string& device_id, 64 const std::string& device_id,
74 const std::string& user_name, 65 const std::string& user_name,
75 const std::string& gaia_token, 66 const std::string& gaia_token,
76 bool token_cache_loaded); 67 bool token_cache_loaded);
77 68
78 void set_device_id(const std::string& device_id); 69 void set_device_id(const std::string& device_id);
79 void set_user_name(const std::string& user_name); 70 void set_user_name(const std::string& user_name);
80 void set_user_affiliation(UserAffiliation user_affiliation);
81 71
82 const std::string& device_id() const; 72 const std::string& device_id() const;
83 const std::string& device_token() const; 73 const std::string& device_token() const;
84 const std::string& gaia_token() const; 74 const std::string& gaia_token() const;
85 const std::string& oauth_token() const; 75 const std::string& oauth_token() const;
86 bool has_auth_token() const; 76 bool has_auth_token() const;
87 const std::string& machine_id() const; 77 const std::string& machine_id() const;
88 const std::string& machine_model() const; 78 const std::string& machine_model() const;
89 em::DeviceRegisterRequest_Type policy_register_type() const; 79 em::DeviceRegisterRequest_Type policy_register_type() const;
90 const std::string& policy_type() const; 80 const std::string& policy_type() const;
91 bool token_cache_loaded() const; 81 bool token_cache_loaded() const;
92 const std::string& user_name() const; 82 const std::string& user_name() const;
93 const UserAffiliation user_affiliation() const;
94 83
95 void AddObserver(Observer* observer); 84 void AddObserver(Observer* observer);
96 void RemoveObserver(Observer* observer); 85 void RemoveObserver(Observer* observer);
97 86
98 void NotifyCredentialsChanged(); 87 void NotifyCredentialsChanged();
99 void NotifyDeviceTokenChanged(); 88 void NotifyDeviceTokenChanged();
100 89
101 private: 90 private:
102 CloudPolicyDataStore( 91 CloudPolicyDataStore(
103 const em::DeviceRegisterRequest_Type policy_register_type, 92 const em::DeviceRegisterRequest_Type policy_register_type,
104 const std::string& policy_type, 93 const std::string& policy_type,
105 const std::string& machine_model, 94 const std::string& machine_model,
106 const std::string& machine_id); 95 const std::string& machine_id);
107 96
108 // Data necessary for constructing register requests. 97 // Data necessary for constructing register requests.
109 std::string gaia_token_; 98 std::string gaia_token_;
110 std::string oauth_token_; 99 std::string oauth_token_;
111 std::string user_name_; 100 std::string user_name_;
112 101
113 // Data necessary for constructing policy requests. 102 // Data necessary for constructing policy requests.
114 std::string device_token_; 103 std::string device_token_;
115 UserAffiliation user_affiliation_;
116 104
117 // Constants that won't change over the life-time of a cloud policy 105 // Constants that won't change over the life-time of a cloud policy
118 // subsystem. 106 // subsystem.
119 const em::DeviceRegisterRequest_Type policy_register_type_; 107 const em::DeviceRegisterRequest_Type policy_register_type_;
120 const std::string policy_type_; 108 const std::string policy_type_;
121 const std::string machine_model_; 109 const std::string machine_model_;
122 const std::string machine_id_; 110 const std::string machine_id_;
123 111
124 // Data used for constructiong both register and policy requests. 112 // Data used for constructiong both register and policy requests.
125 std::string device_id_; 113 std::string device_id_;
126 114
127 bool token_cache_loaded_; 115 bool token_cache_loaded_;
128 116
129 ObserverList<Observer, true> observer_list_; 117 ObserverList<Observer, true> observer_list_;
130 118
131 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore); 119 DISALLOW_COPY_AND_ASSIGN(CloudPolicyDataStore);
132 }; 120 };
133 121
134 } // namespace policy 122 } // namespace policy
135 123
136 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_ 124 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_DATA_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_controller_unittest.cc ('k') | chrome/browser/policy/cloud_policy_data_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698