1 // Copyright (c) 2012 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_SCREEN_FLOW_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_FLOW_H_ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 12 namespace chromeos { 13 14 class ScreenContext; 15 class ScreenManager; 16 17 // Class that holds the logic of interpreting screen outcomes and moving between 18 // the screens. 19 class ScreenFlow { 20 public: 21 ScreenFlow(); 22 virtual ~ScreenFlow(); 23 24 // Called once the flow is set as a flow for specific screen manager. 25 // Should usually result in get_manager()->ShowScreen call. 26 virtual void Start() = 0; 27 28 // Called when screen with |screen_id| finishes with |outcome|. 29 // Additional result parameters may be passed via |context| (always not NULL). 30 // Should result in get_manager()->ShowScreen call or in 31 // get_manager()->SetScreenFlow call. 32 virtual void OnScreenFinished(const std::string& screen_id, 33 const std::string& outcome, 34 ScreenContext* context) = 0; 35 protected: 36 ScreenManager* screen_manager() { return manager_; } 37 38 private: 39 friend class ScreenManager; 40 41 void set_screen_manager(ScreenManager* manager) { 42 manager_ = manager; 43 } 44 45 // Screen manager associated with this flow. Set by screen manager itself. 46 ScreenManager* manager_; 47 48 DISALLOW_COPY_AND_ASSIGN(ScreenFlow); 49 }; 50 51 } // namespace chromeos 52 53 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_FLOW_H_ 54