OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSIONS_CRX_INSTALLER_ERROR_H_ | 5 #ifndef EXTENSIONS_BROWSER_INSTALL_CRX_INSTALLER_ERROR_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_ERROR_H_ | 6 #define EXTENSIONS_BROWSER_INSTALL_CRX_INSTALLER_ERROR_H_ |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
11 | 11 |
12 // Simple error class for CrxInstaller. | 12 // Simple error class for CrxInstaller. |
13 class CrxInstallerError { | 13 class CrxInstallerError { |
14 public: | 14 public: |
15 // Typed errors that need to be handled specially by clients. | 15 // Typed errors that need to be handled specially by clients. |
16 enum Type { | 16 enum Type { ERROR_NONE, ERROR_OFF_STORE, ERROR_OTHER }; |
17 ERROR_NONE, | |
18 ERROR_OFF_STORE, | |
19 ERROR_OTHER | |
20 }; | |
21 | 17 |
22 CrxInstallerError() : type_(ERROR_NONE) { | 18 CrxInstallerError() : type_(ERROR_NONE) {} |
23 } | |
24 | 19 |
25 explicit CrxInstallerError(const base::string16& message) | 20 explicit CrxInstallerError(const base::string16& message) |
26 : type_(message.empty() ? ERROR_NONE : ERROR_OTHER), | 21 : type_(message.empty() ? ERROR_NONE : ERROR_OTHER), message_(message) {} |
27 message_(message) { | |
28 } | |
29 | 22 |
30 CrxInstallerError(Type type, const base::string16& message) | 23 CrxInstallerError(Type type, const base::string16& message) |
31 : type_(type), message_(message) { | 24 : type_(type), message_(message) {} |
32 } | |
33 | 25 |
34 Type type() const { return type_; } | 26 Type type() const { return type_; } |
35 const base::string16& message() const { return message_; } | 27 const base::string16& message() const { return message_; } |
36 | 28 |
37 private: | 29 private: |
38 Type type_; | 30 Type type_; |
39 base::string16 message_; | 31 base::string16 message_; |
40 }; | 32 }; |
41 | 33 |
42 } // namespace extensions | 34 } // namespace extensions |
43 | 35 |
44 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_ERROR_H_ | 36 #endif // EXTENSIONS_BROWSER_INSTALL_CRX_INSTALLER_ERROR_H_ |
OLD | NEW |