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 #include "chrome/browser/chromeos/cros/login_library.h" | 5 #include "chrome/browser/chromeos/cros/login_library.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "base/timer.h" | 9 #include "base/timer.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 if (session_connection_) { | 33 if (session_connection_) { |
34 chromeos::DisconnectSession(session_connection_); | 34 chromeos::DisconnectSession(session_connection_); |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 bool EmitLoginPromptReady() { | 38 bool EmitLoginPromptReady() { |
39 return chromeos::EmitLoginPromptReady(); | 39 return chromeos::EmitLoginPromptReady(); |
40 } | 40 } |
41 | 41 |
42 void RequestRetrievePolicy(RetrievePolicyCallback callback, void* delegate) { | 42 void RequestRetrievePolicy(RetrievePolicyCallback callback, void* delegate) { |
43 DCHECK(callback) << "must provide a callback to RequestRetrievePolicy()"; | 43 DCHECK(callback) << "must provide a callback!"; |
44 chromeos::RetrievePolicy(callback, delegate); | 44 chromeos::RetrievePolicy(callback, delegate); |
45 } | 45 } |
46 | 46 |
47 void RequestStorePolicy(const std::string& policy, | 47 void RequestStorePolicy(const std::string& policy, |
48 StorePolicyCallback callback, | 48 StorePolicyCallback callback, |
49 void* delegate) { | 49 void* delegate) { |
50 DCHECK(callback) << "must provide a callback to StorePolicy()"; | 50 DCHECK(callback) << "must provide a callback!"; |
51 chromeos::StorePolicy(policy.c_str(), policy.length(), callback, delegate); | 51 chromeos::StorePolicy(policy.c_str(), policy.length(), callback, delegate); |
52 } | 52 } |
53 | 53 |
| 54 void RequestRetrieveUserPolicy(RetrievePolicyCallback callback, |
| 55 void* delegate) { |
| 56 DCHECK(callback) << "must provide a callback!"; |
| 57 chromeos::RetrieveUserPolicy(callback, delegate); |
| 58 } |
| 59 |
| 60 void RequestStoreUserPolicy(const std::string& policy, |
| 61 StorePolicyCallback callback, |
| 62 void* delegate) { |
| 63 DCHECK(callback) << "must provide a callback!"; |
| 64 chromeos::StoreUserPolicy(policy.c_str(), policy.length(), |
| 65 callback, delegate); |
| 66 } |
| 67 |
54 bool StartSession(const std::string& user_email, | 68 bool StartSession(const std::string& user_email, |
55 const std::string& unique_id /* unused */) { | 69 const std::string& unique_id /* unused */) { |
56 // only pass unique_id through once we use it for something. | 70 // only pass unique_id through once we use it for something. |
57 return chromeos::StartSession(user_email.c_str(), ""); | 71 return chromeos::StartSession(user_email.c_str(), ""); |
58 } | 72 } |
59 | 73 |
60 bool StopSession(const std::string& unique_id /* unused */) { | 74 bool StopSession(const std::string& unique_id /* unused */) { |
61 // only pass unique_id through once we use it for something. | 75 // only pass unique_id through once we use it for something. |
62 return chromeos::StopSession(""); | 76 return chromeos::StopSession(""); |
63 } | 77 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 229 |
216 bool EmitLoginPromptReady() { return true; } | 230 bool EmitLoginPromptReady() { return true; } |
217 void RequestRetrievePolicy(RetrievePolicyCallback callback, void* delegate) { | 231 void RequestRetrievePolicy(RetrievePolicyCallback callback, void* delegate) { |
218 callback(delegate, "", 0); | 232 callback(delegate, "", 0); |
219 } | 233 } |
220 void RequestStorePolicy(const std::string& policy, | 234 void RequestStorePolicy(const std::string& policy, |
221 StorePolicyCallback callback, | 235 StorePolicyCallback callback, |
222 void* delegate) { | 236 void* delegate) { |
223 callback(delegate, true); | 237 callback(delegate, true); |
224 } | 238 } |
| 239 void RequestRetrieveUserPolicy(RetrievePolicyCallback callback, |
| 240 void* delegate) { |
| 241 callback(delegate, "", 0); |
| 242 } |
| 243 void RequestStoreUserPolicy(const std::string& policy, |
| 244 StorePolicyCallback callback, |
| 245 void* delegate) { |
| 246 callback(delegate, true); |
| 247 } |
225 bool StartSession(const std::string& user_email, | 248 bool StartSession(const std::string& user_email, |
226 const std::string& unique_id /* unused */) { return true; } | 249 const std::string& unique_id /* unused */) { return true; } |
227 bool StopSession(const std::string& unique_id /* unused */) { return true; } | 250 bool StopSession(const std::string& unique_id /* unused */) { return true; } |
228 bool RestartJob(int pid, const std::string& command_line) { return true; } | 251 bool RestartJob(int pid, const std::string& command_line) { return true; } |
229 bool RestartEntd() { return true; } | 252 bool RestartEntd() { return true; } |
230 | 253 |
231 private: | 254 private: |
232 DISALLOW_COPY_AND_ASSIGN(LoginLibraryStubImpl); | 255 DISALLOW_COPY_AND_ASSIGN(LoginLibraryStubImpl); |
233 }; | 256 }; |
234 | 257 |
235 // static | 258 // static |
236 LoginLibrary* LoginLibrary::GetImpl(bool stub) { | 259 LoginLibrary* LoginLibrary::GetImpl(bool stub) { |
237 if (stub) | 260 if (stub) |
238 return new LoginLibraryStubImpl(); | 261 return new LoginLibraryStubImpl(); |
239 else | 262 else |
240 return new LoginLibraryImpl(); | 263 return new LoginLibraryImpl(); |
241 } | 264 } |
242 | 265 |
243 } // namespace chromeos | 266 } // namespace chromeos |
OLD | NEW |