shutdown_reason.cc 777 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 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. #include "ash/shutdown_reason.h"
  5. #include <ostream>
  6. #include "base/notreached.h"
  7. namespace ash {
  8. const char* ShutdownReasonToString(ShutdownReason reason) {
  9. switch (reason) {
  10. case ShutdownReason::POWER_BUTTON:
  11. return "power button";
  12. case ShutdownReason::LOGIN_SHUT_DOWN_BUTTON:
  13. return "login shut down button";
  14. case ShutdownReason::TRAY_SHUT_DOWN_BUTTON:
  15. return "tray shut down button";
  16. case ShutdownReason::ARC_POWER_BUTTON:
  17. return "arc power button";
  18. }
  19. NOTREACHED() << "Invalid reason " << static_cast<int>(reason);
  20. return "invalid";
  21. }
  22. } // namespace ash