Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCH_ERROR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCH_ERROR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCH_ERROR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCH_ERROR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 class AuthFailure; | |
| 15 | |
| 14 class KioskAppLaunchError { | 16 class KioskAppLaunchError { |
| 15 public: | 17 public: |
| 18 // Enum used for UMA. Do NOT reorder or remove entry. Don't forget to | |
| 19 // update histograms.xml when adding new entries. | |
| 16 enum Error { | 20 enum Error { |
| 17 NONE, // No error. | 21 NONE = 0, // No error. |
| 18 HAS_PENDING_LAUNCH, // There is a pending launch already. | 22 HAS_PENDING_LAUNCH = 1, // There is a pending launch already. |
| 19 CRYPTOHOMED_NOT_RUNNING, // Unable to call cryptohome daemon. | 23 CRYPTOHOMED_NOT_RUNNING = 2, // Unable to call cryptohome daemon. |
| 20 ALREADY_MOUNTED, // Cryptohome is already mounted. | 24 ALREADY_MOUNTED = 3, // Cryptohome is already mounted. |
| 21 UNABLE_TO_MOUNT, // Unable to mount cryptohome. | 25 UNABLE_TO_MOUNT = 4, // Unable to mount cryptohome. |
| 22 UNABLE_TO_REMOVE, // Unable to remove cryptohome. | 26 UNABLE_TO_REMOVE = 5, // Unable to remove cryptohome. |
| 23 UNABLE_TO_INSTALL, // Unable to install app. | 27 UNABLE_TO_INSTALL = 6, // Unable to install app. |
| 24 USER_CANCEL, // Canceled by user. | 28 USER_CANCEL = 7, // Canceled by user. |
| 25 NOT_KIOSK_ENABLED, // Not a kiosk enabled app. | 29 NOT_KIOSK_ENABLED = 8, // Not a kiosk enabled app. |
| 26 UNABLE_TO_RETRIEVE_HASH, // Unable to retrieve username hash. | 30 UNABLE_TO_RETRIEVE_HASH = 9, // Unable to retrieve username hash. |
| 27 POLICY_LOAD_FAILED, // Failed to load policy for kiosk account. | 31 POLICY_LOAD_FAILED = 10, // Failed to load policy for kiosk account. |
| 28 UNABLE_TO_DOWNLOAD, // Unable to download app's crx file. | 32 UNABLE_TO_DOWNLOAD = 11, // Unable to download app's crx file. |
| 29 UNABLE_TO_LAUNCH, // Unable to launch app. | 33 UNABLE_TO_LAUNCH = 12, // Unable to launch app. |
| 30 ARC_AUTH_FAILED, // Failed to authorise ARC session | 34 ARC_AUTH_FAILED = 13, // Failed to authorise ARC session |
| 35 ERROR_COUNT, // Count of all errors. | |
| 31 }; | 36 }; |
| 32 | 37 |
| 33 // Returns a message for given |error|. | 38 // Returns a message for given |error|. |
| 34 static std::string GetErrorMessage(Error error); | 39 static std::string GetErrorMessage(Error error); |
| 35 | 40 |
| 36 // Save error for displaying on next restart. Note only the last saved error | 41 // Saves a launch error. The error is used on the next Chrome run to report |
| 37 // will be kept. | 42 // metrics and display a message to the user. |
| 38 static void Save(Error error); | 43 static void Save(Error error); |
| 39 | 44 |
| 45 // Saves a cryptohome auth error. The error is used for metrics report on the | |
| 46 // next Chrome run. | |
| 47 static void SaveCryptohomeFailure(const AuthFailure& auth_failure); | |
| 48 | |
| 40 // Gets the saved error. | 49 // Gets the saved error. |
| 41 static Error Get(); | 50 static Error Get(); |
| 42 | 51 |
| 43 // Clears the saved error. | 52 // Records the launch error metric and clears it. |
|
Ilya Sherman
2017/03/01 00:44:26
Perhaps document that this method records and clea
xiyuan
2017/03/01 17:01:35
Done.
| |
| 44 static void Clear(); | 53 static void RecordMetricAndClear(); |
| 45 | 54 |
| 46 private: | 55 private: |
| 47 DISALLOW_IMPLICIT_CONSTRUCTORS(KioskAppLaunchError); | 56 DISALLOW_IMPLICIT_CONSTRUCTORS(KioskAppLaunchError); |
| 48 }; | 57 }; |
| 49 | 58 |
| 50 } // namespace chromeos | 59 } // namespace chromeos |
| 51 | 60 |
| 52 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCH_ERROR_H_ | 61 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_LAUNCH_ERROR_H_ |
| OLD | NEW |