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_INSTALLER_ERROR_H_
6 #define EXTENSIONS_BROWSER_INSTALL_CRX_INSTALLER_ERROR_H_
8 #include "base/strings/string16.h"
10 namespace extensions
{
12 // Simple error class for CrxInstaller.
13 class CrxInstallerError
{
15 // Typed errors that need to be handled specially by clients.
16 enum Type
{ ERROR_NONE
, ERROR_OFF_STORE
, ERROR_OTHER
};
18 CrxInstallerError() : type_(ERROR_NONE
) {}
20 explicit CrxInstallerError(const base::string16
& message
)
21 : type_(message
.empty() ? ERROR_NONE
: ERROR_OTHER
), message_(message
) {}
23 CrxInstallerError(Type type
, const base::string16
& message
)
24 : type_(type
), message_(message
) {}
26 Type
type() const { return type_
; }
27 const base::string16
& message() const { return message_
; }
31 base::string16 message_
;
34 } // namespace extensions
36 #endif // EXTENSIONS_BROWSER_INSTALL_CRX_INSTALLER_ERROR_H_