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.
5 #ifndef EXTENSIONS_BROWSER_INSTALL_CRX_INSTALL_ERROR_H_
6 #define EXTENSIONS_BROWSER_INSTALL_CRX_INSTALL_ERROR_H_
8 #include "base/strings/string16.h"
10 namespace extensions
{
12 // Simple error class for CrxInstaller.
13 class CrxInstallError
{
15 // Typed errors that need to be handled specially by clients.
16 // ERROR_OFF_STORE for disallowed off-store installations.
17 // ERROR_DECLINED for situations when a .crx file seems to be OK, but there
18 // are some policy restrictions or unmet dependencies that prevent it from
20 // ERROR_HASH_MISMATCH if the expected extension SHA256 hash sum is different
21 // from the actual one.
30 CrxInstallError() : type_(ERROR_NONE
) {}
32 explicit CrxInstallError(const base::string16
& message
)
33 : type_(message
.empty() ? ERROR_NONE
: ERROR_OTHER
), message_(message
) {}
35 CrxInstallError(Type type
, const base::string16
& message
)
36 : type_(type
), message_(message
) {}
38 Type
type() const { return type_
; }
39 const base::string16
& message() const { return message_
; }
43 base::string16 message_
;
46 } // namespace extensions
48 #endif // EXTENSIONS_BROWSER_INSTALL_CRX_INSTALL_ERROR_H_