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_WAITING_FOR_CONTROLLER,
19 STAGE_WAITING_FOR_CODE_CONFIRMATION,
21 STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE,
22 STAGE_WAITING_FOR_CREDENTIALS,
24 STAGE_ENROLLMENT_ERROR,
29 struct UpdateProgress {
39 // Called when pairing has moved on from one stage to another.
40 virtual void PairingStageChanged(Stage new_stage) = 0;
42 // Called periodically on |STAGE_UPDATING| stage. Current update progress
43 // is stored in |progress|.
44 virtual void UpdateAdvanced(const UpdateProgress& progress) = 0;
47 DISALLOW_COPY_AND_ASSIGN(Observer);
50 HostPairingController();
51 virtual ~HostPairingController();
53 virtual void AddObserver(Observer* observer) = 0;
54 virtual void RemoveObserver(Observer* observer) = 0;
56 // Returns current stage of pairing process.
57 virtual Stage GetCurrentStage() = 0;
59 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
60 virtual void StartPairing() = 0;
62 // Returns device name.
63 virtual std::string GetDeviceName() = 0;
65 // Returns 6-digit confirmation code. Can be called only on
66 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
67 virtual std::string GetConfirmationCode() = 0;
69 // Returns an enrollment domain name. Can be called on stage
70 // |STAGE_ENROLLMENT| and later.
71 virtual std::string GetEnrollmentDomain() = 0;
74 DISALLOW_COPY_AND_ASSIGN(HostPairingController);
77 } // namespace pairing_chromeos
79 #endif // COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_