Unregister from GCM when the only GCM app is removed
[chromium-blink-merge.git] / extensions / browser / install / crx_installer_error.h
blob47d0932b217973de8115515e4419eb7cf512bc2b
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 {
14 public:
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
19 // being installed.
20 enum Type { ERROR_NONE, ERROR_OFF_STORE, ERROR_DECLINED, ERROR_OTHER };
22 CrxInstallerError() : type_(ERROR_NONE) {}
24 explicit CrxInstallerError(const base::string16& message)
25 : type_(message.empty() ? ERROR_NONE : ERROR_OTHER), message_(message) {}
27 CrxInstallerError(Type type, const base::string16& message)
28 : type_(type), message_(message) {}
30 Type type() const { return type_; }
31 const base::string16& message() const { return message_; }
33 private:
34 Type type_;
35 base::string16 message_;
38 } // namespace extensions
40 #endif // EXTENSIONS_BROWSER_INSTALL_CRX_INSTALLER_ERROR_H_