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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h

Issue 2954293002: Chromad: Prevent session from starting without policy (Closed)
Patch Set: Comment fixes Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Called once the policy access token is available, and starts the 124 // Called once the policy access token is available, and starts the
125 // registration with the policy server if the token was successfully fetched. 125 // registration with the policy server if the token was successfully fetched.
126 void OnOAuth2PolicyTokenFetched(const std::string& policy_token, 126 void OnOAuth2PolicyTokenFetched(const std::string& policy_token,
127 const GoogleServiceAuthError& error); 127 const GoogleServiceAuthError& error);
128 128
129 // Completion handler for the explicit policy fetch triggered on startup in 129 // Completion handler for the explicit policy fetch triggered on startup in
130 // case |wait_for_policy_fetch_| is true. |success| is true if the fetch was 130 // case |wait_for_policy_fetch_| is true. |success| is true if the fetch was
131 // successful. 131 // successful.
132 void OnInitialPolicyFetchComplete(bool success); 132 void OnInitialPolicyFetchComplete(bool success);
133 133
134 // Called when |policy_fetch_timeout_| times out, to cancel the blocking 134 // Called when |policy_fetch_timeout_| times out, to cancel the blocking wait
135 // wait for the initial policy fetch. 135 // for the initial policy fetch.
136 void OnBlockingFetchTimeout(); 136 void OnBlockingFetchTimeout();
137 137
138 // Cancels waiting for the policy fetch and flags the 138 // Cancels waiting for the initial policy fetch and flags the
139 // ConfigurationPolicyProvider ready (assuming all other initialization tasks 139 // ConfigurationPolicyProvider ready (assuming all other initialization tasks
140 // have completed). Pass |true| if policy fetch was successful (either 140 // have completed). Pass |true| if policy fetch was successful (either because
141 // because policy was successfully fetched, or if DMServer has notified us 141 // policy was successfully fetched, or if DMServer has notified us that the
142 // that the user is not managed). 142 // user is not managed).
143 void CancelWaitForPolicyFetch(bool success); 143 void CancelWaitForPolicyFetch(bool success);
144 144
145 void StartRefreshSchedulerIfReady(); 145 void StartRefreshSchedulerIfReady();
146 146
147 // Owns the store, note that CloudPolicyManager just keeps a plain pointer. 147 // Owns the store, note that CloudPolicyManager just keeps a plain pointer.
148 std::unique_ptr<CloudPolicyStore> store_; 148 std::unique_ptr<CloudPolicyStore> store_;
149 149
150 // Manages external data referenced by policies. 150 // Manages external data referenced by policies.
151 std::unique_ptr<CloudExternalDataManager> external_data_manager_; 151 std::unique_ptr<CloudExternalDataManager> external_data_manager_;
152 152
153 // Username for the wildcard login check if applicable, empty otherwise. 153 // Username for the wildcard login check if applicable, empty otherwise.
154 std::string wildcard_username_; 154 std::string wildcard_username_;
155 155
156 // Path where policy for components will be cached. 156 // Path where policy for components will be cached.
157 base::FilePath component_policy_cache_path_; 157 base::FilePath component_policy_cache_path_;
158 158
159 // Whether to wait for a policy fetch to complete before reporting 159 // Whether we're waiting for a policy fetch to complete before reporting
160 // IsInitializationComplete(). 160 // IsInitializationComplete().
161 bool wait_for_policy_fetch_; 161 bool waiting_for_initial_policy_fetch_;
162 162
163 // Whether we should allow policy fetches to fail, or wait forever until they 163 // Whether the user session is continued in case of failure of initial policy
164 // succeed (typically we won't allow them to fail until we have loaded policy 164 // fetch.
165 // at least once). 165 bool initial_policy_fetch_may_fail_;
166 bool allow_failed_policy_fetches_;
167 166
168 // A timer that puts a hard limit on the maximum time to wait for the initial 167 // A timer that puts a hard limit on the maximum time to wait for the initial
169 // policy fetch. 168 // policy fetch.
170 base::Timer policy_fetch_timeout_{false, false}; 169 base::Timer policy_fetch_timeout_{false /* retain_user_task */,
emaxx 2017/07/12 20:18:20 (just note) Thanks for doing this cleanup!
170 false /* is_repeating */};
171 171
172 // The pref service to pass to the refresh scheduler on initialization. 172 // The pref service to pass to the refresh scheduler on initialization.
173 PrefService* local_state_; 173 PrefService* local_state_;
174 174
175 // Used to fetch the policy OAuth token, when necessary. This object holds 175 // Used to fetch the policy OAuth token, when necessary. This object holds
176 // a callback with an unretained reference to the manager, when it exists. 176 // a callback with an unretained reference to the manager, when it exists.
177 std::unique_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; 177 std::unique_ptr<PolicyOAuth2TokenFetcher> token_fetcher_;
178 178
179 // Keeps alive the wildcard checker while its running. 179 // Keeps alive the wildcard checker while its running.
180 std::unique_ptr<WildcardLoginChecker> wildcard_login_checker_; 180 std::unique_ptr<WildcardLoginChecker> wildcard_login_checker_;
(...skipping 12 matching lines...) Expand all
193 // TODO(emaxx): Remove after the crashes tracked at https://crbug.com/685996 193 // TODO(emaxx): Remove after the crashes tracked at https://crbug.com/685996
194 // are fixed. 194 // are fixed.
195 base::debug::StackTrace connect_callstack_; 195 base::debug::StackTrace connect_callstack_;
196 196
197 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); 197 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS);
198 }; 198 };
199 199
200 } // namespace policy 200 } // namespace policy
201 201
202 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 202 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698