controller_pairing_screen.h revision 5f1c94371a64b3196d4be9466099bb892df9b88e
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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_H_
6#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_H_
7
8#include "base/macros.h"
9
10#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h"
11#include "chrome/browser/chromeos/login/screens/screen_context.h"
12#include "chrome/browser/chromeos/login/screens/wizard_screen.h"
13#include "components/pairing/controller_pairing_controller.h"
14
15namespace chromeos {
16
17class ControllerPairingScreen :
18  public WizardScreen,
19  public pairing_chromeos::ControllerPairingController::Observer,
20  public ControllerPairingScreenActor::Delegate {
21 public:
22  ControllerPairingScreen(ScreenObserver* observer,
23                          ControllerPairingScreenActor* actor);
24  virtual ~ControllerPairingScreen();
25
26 private:
27  typedef pairing_chromeos::ControllerPairingController::Stage Stage;
28
29  void CommitContextChanges();
30  bool ExpectStageIs(Stage stage) const;
31
32  // Overridden from WizardScreen:
33  virtual void PrepareToShow() OVERRIDE;
34  virtual void Show() OVERRIDE;
35  virtual void Hide() OVERRIDE;
36  virtual std::string GetName() const OVERRIDE;
37
38  // Overridden from pairing_chromeos::ControllerPairingController::Observer:
39  virtual void PairingStageChanged(Stage new_stage) OVERRIDE;
40  virtual void DiscoveredDevicesListChanged() OVERRIDE;
41
42  // Overridden from ControllerPairingView::Delegate:
43  virtual void OnActorDestroyed(ControllerPairingScreenActor* actor) OVERRIDE;
44  virtual void OnScreenContextChanged(
45      const base::DictionaryValue& diff) OVERRIDE;
46  virtual void OnUserActed(const std::string& action) OVERRIDE;
47
48  // Context for sharing data between C++ and JS.
49  // TODO(dzhioev): move to BaseScreen when possible.
50  ScreenContext context_;
51
52  ControllerPairingScreenActor* actor_;
53
54  // Controller performing pairing. Owned by the screen for now.
55  // TODO(dzhioev): move to proper place later.
56  scoped_ptr<pairing_chromeos::ControllerPairingController> controller_;
57
58  // Current stage of pairing process.
59  Stage current_stage_;
60
61  // If this one is |false| first device in device list will be preselected on
62  // next device list update.
63  bool device_preselected_;
64
65  DISALLOW_COPY_AND_ASSIGN(ControllerPairingScreen);
66};
67
68}  // namespace chromeos
69
70#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_H_
71