OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_registration_utility.h" | 5 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Registers a new supervised user with the server. |supervised_user_id| is a | 54 // Registers a new supervised user with the server. |supervised_user_id| is a |
55 // new unique ID for the new supervised user. If its value is the same as that | 55 // new unique ID for the new supervised user. If its value is the same as that |
56 // of one of the existing supervised users, then the same user will be created | 56 // of one of the existing supervised users, then the same user will be created |
57 // on this machine (and if he has no avatar in sync, his avatar will be | 57 // on this machine (and if he has no avatar in sync, his avatar will be |
58 // updated). |info| contains necessary information like the display name of | 58 // updated). |info| contains necessary information like the display name of |
59 // the user and his avatar. |callback| is called with the result of the | 59 // the user and his avatar. |callback| is called with the result of the |
60 // registration. We use the info here and not the profile, because on Chrome | 60 // registration. We use the info here and not the profile, because on Chrome |
61 // OS the profile of the supervised user does not yet exist. | 61 // OS the profile of the supervised user does not yet exist. |
62 virtual void Register(const std::string& supervised_user_id, | 62 virtual void Register(const std::string& supervised_user_id, |
63 const SupervisedUserRegistrationInfo& info, | 63 const SupervisedUserRegistrationInfo& info, |
64 const RegistrationCallback& callback) OVERRIDE; | 64 const RegistrationCallback& callback) override; |
65 | 65 |
66 // SupervisedUserSyncServiceObserver: | 66 // SupervisedUserSyncServiceObserver: |
67 virtual void OnSupervisedUserAcknowledged( | 67 virtual void OnSupervisedUserAcknowledged( |
68 const std::string& supervised_user_id) OVERRIDE; | 68 const std::string& supervised_user_id) override; |
69 virtual void OnSupervisedUsersSyncingStopped() OVERRIDE; | 69 virtual void OnSupervisedUsersSyncingStopped() override; |
70 virtual void OnSupervisedUsersChanged() OVERRIDE; | 70 virtual void OnSupervisedUsersChanged() override; |
71 | 71 |
72 private: | 72 private: |
73 // Fetches the supervised user token when we have the device name. | 73 // Fetches the supervised user token when we have the device name. |
74 void FetchToken(const std::string& client_name); | 74 void FetchToken(const std::string& client_name); |
75 | 75 |
76 // Called when we have received a token for the supervised user. | 76 // Called when we have received a token for the supervised user. |
77 void OnReceivedToken(const GoogleServiceAuthError& error, | 77 void OnReceivedToken(const GoogleServiceAuthError& error, |
78 const std::string& token); | 78 const std::string& token); |
79 | 79 |
80 // Dispatches the callback and cleans up if all the conditions have been met. | 80 // Dispatches the callback and cleans up if all the conditions have been met. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 pending_supervised_user_id_); | 408 pending_supervised_user_id_); |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 if (run_callback) | 412 if (run_callback) |
413 callback_.Run(error, pending_supervised_user_token_); | 413 callback_.Run(error, pending_supervised_user_token_); |
414 callback_.Reset(); | 414 callback_.Reset(); |
415 } | 415 } |
416 | 416 |
417 } // namespace | 417 } // namespace |
OLD | NEW |