Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chromeos/pairing/host_pairing_controller.h

Issue 387163002: Move Chrome OS pairing interface to chrome/browser/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Leave chromeos/pairing intact for try jobs Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_
6 #define CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "chromeos/chromeos_export.h"
12
13 namespace chromeos {
14
15 class CHROMEOS_EXPORT HostPairingController {
16 public:
17 enum Stage {
18 STAGE_NONE,
19 STAGE_WAITING_FOR_CONTROLLER,
20 STAGE_WAITING_FOR_CODE_CONFIRMATION,
21 STAGE_UPDATING,
22 STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE,
23 STAGE_WAITING_FOR_CREDENTIALS,
24 STAGE_ENROLLING,
25 STAGE_ENROLLMENT_ERROR,
26 STAGE_PAIRING_DONE,
27 STAGE_FINISHED
28 };
29
30 struct UpdateProgress {
31 // Number in [0, 1].
32 double progress;
33 };
34
35 class Observer {
36 public:
37 Observer();
38 virtual ~Observer();
39
40 // Called when pairing has moved on from one stage to another.
41 virtual void PairingStageChanged(Stage new_stage) = 0;
42
43 // Called periodically on |STAGE_UPDATING| stage. Current update progress
44 // is stored in |progress|.
45 virtual void UpdateAdvanced(const UpdateProgress& progress) = 0;
46
47 private:
48 DISALLOW_COPY_AND_ASSIGN(Observer);
49 };
50
51 HostPairingController();
52 virtual ~HostPairingController();
53
54 virtual void AddObserver(Observer* observer) = 0;
55 virtual void RemoveObserver(Observer* observer) = 0;
56
57 // Returns current stage of pairing process.
58 virtual Stage GetCurrentStage() = 0;
59
60 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
61 virtual void StartPairing() = 0;
62
63 // Returns device name.
64 virtual std::string GetDeviceName() = 0;
65
66 // Returns 6-digit confirmation code. Can be called only on
67 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
68 virtual std::string GetConfirmationCode() = 0;
69
70 // Returns an enrollment domain name. Can be called on stage
71 // |STAGE_ENROLLMENT| and later.
72 virtual std::string GetEnrollmentDomain() = 0;
73
74 private:
75 DISALLOW_COPY_AND_ASSIGN(HostPairingController);
76 };
77
78 } // namespace chromeos
79
80 #endif // CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698