app_state_tracker.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2015 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. #ifndef CHROMECAST_CRASH_APP_STATE_TRACKER_H_
  5. #define CHROMECAST_CRASH_APP_STATE_TRACKER_H_
  6. #include <string>
  7. namespace chromecast {
  8. class AppStateTracker {
  9. public:
  10. // Record |app_id| as the last app that attempted to launch.
  11. static void SetLastLaunchedApp(const std::string& app_id);
  12. // The current app becomes the previous app, |app_id| becomes the current app.
  13. static void SetCurrentApp(const std::string& app_id);
  14. // Record |app_id| as the previous app.
  15. static void SetPreviousApp(const std::string& app_id);
  16. // Set the Stadia session ID, when a Stadia session starts running.
  17. // Clear the Stadia session ID by passing in an empty string
  18. static void SetStadiaSessionId(const std::string& stadia_session_id);
  19. // Returns the id of the app that was last attempted to launch.
  20. static std::string GetLastLaunchedApp();
  21. // Returns the id of the active app.
  22. static std::string GetCurrentApp();
  23. // Returns the id of the app which was previously active.
  24. static std::string GetPreviousApp();
  25. // Returns the Stadia session ID, if a Stadia session is running.
  26. static std::string GetStadiaSessionId();
  27. };
  28. } // namespace chromecast
  29. #endif // CHROMECAST_CRASH_APP_STATE_TRACKER_H_