forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Defined pairing flow interface for host side.
BUG=375191 TEST=none Review URL: https://codereview.chromium.org/349153004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279434 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
dzhioev@chromium.org
committed
Jun 24, 2014
1 parent
6e227a8
commit 03c32fe
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chromeos/pairing/host_pairing_controller.h" | ||
|
||
namespace chromeos { | ||
|
||
HostPairingController::HostPairingController() {} | ||
|
||
HostPairingController::~HostPairingController() {} | ||
|
||
HostPairingController::Observer::Observer() {} | ||
HostPairingController::Observer::~Observer() {} | ||
|
||
} // namespace chromeos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_ | ||
#define CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/macros.h" | ||
#include "chromeos/chromeos_export.h" | ||
|
||
namespace chromeos { | ||
|
||
class CHROMEOS_EXPORT HostPairingController { | ||
public: | ||
enum Stage { | ||
STAGE_NONE, | ||
STAGE_WAITING_FOR_CONTROLLER, | ||
STAGE_WAITING_FOR_CODE_CONFIRMATION, | ||
STAGE_UPDATING, | ||
STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE, | ||
STAGE_WAITING_FOR_CREDENTIALS, | ||
STAGE_ENROLLING, | ||
STAGE_ENROLLMENT_ERROR, | ||
STAGE_PAIRING_DONE, | ||
STAGE_FINISHED | ||
}; | ||
|
||
struct UpdateProgress { | ||
// Number in [0, 1]. | ||
double progress; | ||
}; | ||
|
||
class Observer { | ||
public: | ||
Observer(); | ||
virtual ~Observer(); | ||
|
||
// Called when pairing has moved on from one stage to another. | ||
virtual void PairingStageChanged(Stage new_stage) = 0; | ||
|
||
// Called periodically on |STAGE_UPDATING| stage. Current update progress | ||
// is stored in |progress|. | ||
virtual void UpdateAdvanced(const UpdateProgress& progress) = 0; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(Observer); | ||
}; | ||
|
||
HostPairingController(); | ||
virtual ~HostPairingController(); | ||
|
||
virtual void AddObserver(Observer* observer) = 0; | ||
virtual void RemoveObserver(Observer* observer) = 0; | ||
|
||
// Returns current stage of pairing process. | ||
virtual Stage GetCurrentStage() = 0; | ||
|
||
// Starts pairing process. Can be called only on |STAGE_NONE| stage. | ||
virtual void StartPairing() = 0; | ||
|
||
// Returns device name. | ||
virtual std::string GetDeviceName() = 0; | ||
|
||
// Returns 6-digit confirmation code. Can be called only on | ||
// |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage. | ||
virtual std::string GetConfirmationCode() = 0; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(HostPairingController); | ||
}; | ||
|
||
} // namespace chromeos | ||
|
||
#endif // CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_ |