Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / supervised_user / legacy / supervised_user_registration_utility_stub.cc
blob2a73e386e4b3f6be1bdb5cf00a39014654909f05
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
3 // found in the LICENSE file.
5 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_utility_stub.h"
7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "google_apis/gaia/gaia_urls.h"
11 #include "google_apis/gaia/google_service_auth_error.h"
13 SupervisedUserRegistrationUtilityStub::SupervisedUserRegistrationUtilityStub()
14 : register_was_called_(false) {
17 SupervisedUserRegistrationUtilityStub::
18 ~SupervisedUserRegistrationUtilityStub() {
21 void SupervisedUserRegistrationUtilityStub::Register(
22 const std::string& supervised_user_id,
23 const SupervisedUserRegistrationInfo& info,
24 const RegistrationCallback& callback) {
25 DCHECK(!register_was_called_);
26 register_was_called_ = true;
27 callback_ = callback;
28 supervised_user_id_ = supervised_user_id;
29 display_name_ = info.name;
30 master_key_ = info.master_key;
33 void SupervisedUserRegistrationUtilityStub::RunSuccessCallback(
34 const std::string& token) {
35 if (callback_.is_null())
36 return;
37 callback_.Run(GoogleServiceAuthError(GoogleServiceAuthError::NONE), token);
38 callback_.Reset();
41 void SupervisedUserRegistrationUtilityStub::RunFailureCallback(
42 const GoogleServiceAuthError::State state) {
43 if (callback_.is_null())
44 return;
45 GoogleServiceAuthError error(state);
46 callback_.Run(error, std::string());
47 callback_.Reset();