controller_pairing_screen.h revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
146d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com// Copyright 2014 The Chromium Authors. All rights reserved. 258cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com// Use of this source code is governed by a BSD-style license that can be 358cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com// found in the LICENSE file. 458cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com 558cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_H_ 658cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_H_ 758cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com 858cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com#include "base/macros.h" 958cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com 1058cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h" 11729a886b335e931e49aa3775d4c0d1c11741afdebradnelson@google.com#include "chrome/browser/chromeos/login/screens/screen_context.h" 12729a886b335e931e49aa3775d4c0d1c11741afdebradnelson@google.com#include "chrome/browser/chromeos/login/screens/wizard_screen.h" 1346d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com#include "components/pairing/controller_pairing_controller.h" 1446d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 1546d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.comnamespace chromeos { 1646d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 1746d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.comclass ControllerPairingScreen : 1846d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com public WizardScreen, 1946d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com public pairing_chromeos::ControllerPairingController::Observer, 2046d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com public ControllerPairingScreenActor::Delegate { 2146d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com public: 2246d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com ControllerPairingScreen( 2346d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com ScreenObserver* observer, 2446d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com ControllerPairingScreenActor* actor, 2546d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com pairing_chromeos::ControllerPairingController* controller); 2646d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual ~ControllerPairingScreen(); 2746d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 2846d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com private: 2946d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com typedef pairing_chromeos::ControllerPairingController::Stage Stage; 3046d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 3146d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com void CommitContextChanges(); 3246d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com bool ExpectStageIs(Stage stage) const; 3346d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 3446d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com // Overridden from WizardScreen: 3546d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void PrepareToShow() OVERRIDE; 3646d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void Show() OVERRIDE; 3746d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void Hide() OVERRIDE; 3846d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual std::string GetName() const OVERRIDE; 3946d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 4046d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com // Overridden from pairing_chromeos::ControllerPairingController::Observer: 4146d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void PairingStageChanged(Stage new_stage) OVERRIDE; 4246d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void DiscoveredDevicesListChanged() OVERRIDE; 4346d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 4446d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com // Overridden from ControllerPairingView::Delegate: 4546d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void OnActorDestroyed(ControllerPairingScreenActor* actor) OVERRIDE; 4646d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void OnScreenContextChanged( 4746d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com const base::DictionaryValue& diff) OVERRIDE; 4846d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com virtual void OnUserActed(const std::string& action) OVERRIDE; 4946d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 5046d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com // Context for sharing data between C++ and JS. 5146d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com // TODO(dzhioev): move to BaseScreen when possible. 5246d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com ScreenContext context_; 5346d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 5446d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com ControllerPairingScreenActor* actor_; 5546d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 5646d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com // Controller performing pairing. Owned by the wizard controller. 5746d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com pairing_chromeos::ControllerPairingController* controller_; 5846d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 5969c5522a3dc3d0906ab836350f53dae34a9897d3bradnelson@google.com // Current stage of pairing process. 6077b7833a5d31c72fb0e081cebea69a04ac28e767bradnelson@google.com Stage current_stage_; 6177b7833a5d31c72fb0e081cebea69a04ac28e767bradnelson@google.com 6277b7833a5d31c72fb0e081cebea69a04ac28e767bradnelson@google.com // If this one is |false| first device in device list will be preselected on 6346d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com // next device list update. 6446d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com bool device_preselected_; 6546d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com 66729a886b335e931e49aa3775d4c0d1c11741afdebradnelson@google.com DISALLOW_COPY_AND_ASSIGN(ControllerPairingScreen); 67729a886b335e931e49aa3775d4c0d1c11741afdebradnelson@google.com}; 6858cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com 6958cc35306d7904897b43f82f85ab70b000f92988bradnelson@google.com} // namespace chromeos 70729a886b335e931e49aa3775d4c0d1c11741afdebradnelson@google.com 71729a886b335e931e49aa3775d4c0d1c11741afdebradnelson@google.com#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CONTROLLER_PAIRING_SCREEN_H_ 72729a886b335e931e49aa3775d4c0d1c11741afdebradnelson@google.com