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 #ifndef COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_
6 #define COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_
10 #include "base/macros.h"
12 namespace pairing_chromeos
{
14 class HostPairingController
{
18 STAGE_INITIALIZATION_ERROR
,
19 STAGE_WAITING_FOR_CONTROLLER
,
20 STAGE_WAITING_FOR_CODE_CONFIRMATION
,
22 STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE
,
23 STAGE_WAITING_FOR_CREDENTIALS
,
25 STAGE_ENROLLMENT_ERROR
,
31 UPDATE_STATUS_UNKNOWN
,
32 UPDATE_STATUS_UPDATING
,
33 UPDATE_STATUS_REBOOTING
,
34 UPDATE_STATUS_UPDATED
,
42 // Called when pairing has moved on from one stage to another.
43 virtual void PairingStageChanged(Stage new_stage
) = 0;
45 // Called when the controller has sent a configuration to apply.
46 virtual void ConfigureHost(bool accepted_eula
,
47 const std::string
& lang
,
48 const std::string
& timezone
,
50 const std::string
& keyboard_layout
) = 0;
52 // Called when the controller has provided an |auth_token| for enrollment.
53 virtual void EnrollHost(const std::string
& auth_token
) = 0;
56 DISALLOW_COPY_AND_ASSIGN(Observer
);
59 HostPairingController();
60 virtual ~HostPairingController();
62 // Returns current stage of pairing process.
63 virtual Stage
GetCurrentStage() = 0;
65 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
66 virtual void StartPairing() = 0;
68 // Returns device name.
69 virtual std::string
GetDeviceName() = 0;
71 // Returns 6-digit confirmation code. Can be called only on
72 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
73 virtual std::string
GetConfirmationCode() = 0;
75 // Returns an enrollment domain name. Can be called on stage
76 // |STAGE_ENROLLMENT| and later.
77 virtual std::string
GetEnrollmentDomain() = 0;
79 // Notify that the update status has changed.
80 // Can be called on stage |STAGE_UPDATING|.
81 virtual void OnUpdateStatusChanged(UpdateStatus update_status
) = 0;
83 virtual void AddObserver(Observer
* observer
) = 0;
84 virtual void RemoveObserver(Observer
* observer
) = 0;
87 DISALLOW_COPY_AND_ASSIGN(HostPairingController
);
90 } // namespace pairing_chromeos
92 #endif // COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_