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

Side by Side Diff: chromeos/pairing/fake_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: Add missing file 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_FAKE_HOST_PAIRING_CONTROLLER_H_
6 #define CHROMEOS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_
7
8 #include "base/macros.h"
9 #include "base/observer_list.h"
10 #include "base/time/time.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/pairing/host_pairing_controller.h"
13
14 namespace chromeos {
15
16 class CHROMEOS_EXPORT FakeHostPairingController
17 : public HostPairingController,
18 public HostPairingController::Observer {
19 public:
20 typedef HostPairingController::Observer Observer;
21
22 // Config is a comma separated list of key-value pairs separated by colon.
23 // Supported options:
24 // * async_duration - integer. Default: 3000.
25 // * start_after_update - {0,1}. Default: 0.
26 // * fail_enrollment - {0,1}. Default: 0.
27 // * code - 6 digits or empty string. Default: empty string. If strings is
28 // empty, random code is generated.
29 // * device_name - string. Default: "Chromebox-01".
30 // * domain - string. Default: "example.com".
31 FakeHostPairingController(const std::string& config);
32 virtual ~FakeHostPairingController();
33
34 // Applies given |config| to flow.
35 void ApplyConfig(const std::string& config);
36
37 // Overridden from HostPairingFlow:
38 virtual void AddObserver(Observer* observer) OVERRIDE;
39 virtual void RemoveObserver(Observer* observer) OVERRIDE;
40 virtual Stage GetCurrentStage() OVERRIDE;
41 virtual void StartPairing() OVERRIDE;
42 virtual std::string GetDeviceName() OVERRIDE;
43 virtual std::string GetConfirmationCode() OVERRIDE;
44 virtual std::string GetEnrollmentDomain() OVERRIDE;
45
46 private:
47 void ChangeStage(Stage new_stage);
48 void ChangeStageLater(Stage new_stage);
49 void SetUpdateProgress(int step);
50
51 // Overridden from HostPairingFlow::Observer:
52 virtual void PairingStageChanged(Stage new_stage) OVERRIDE;
53 virtual void UpdateAdvanced(const UpdateProgress& progress) OVERRIDE;
54
55 ObserverList<Observer> observers_;
56 Stage current_stage_;
57 std::string device_name_;
58 std::string confirmation_code_;
59 base::TimeDelta async_duration_;
60
61 // If this flag is true error happens on |STAGE_ENROLLING| once.
62 bool enrollment_should_fail_;
63
64 // Controller starts its work like if update and reboot already happened.
65 bool start_after_update_;
66
67 std::string enrollment_domain_;
68
69 DISALLOW_COPY_AND_ASSIGN(FakeHostPairingController);
70 };
71
72 } // namespace chromeos
73
74 #endif // CHROMEOS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698