Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / extensions / browser / install / crx_install_error.h
blobaf25df66dbcdc361b8c90db662d2466ba1d9b527
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 {
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 // ERROR_HASH_MISMATCH if the expected extension SHA256 hash sum is different
21 // from the actual one.
22 enum Type {
23 ERROR_NONE,
24 ERROR_OFF_STORE,
25 ERROR_DECLINED,
26 ERROR_HASH_MISMATCH,
27 ERROR_OTHER
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_; }
41 private:
42 Type type_;
43 base::string16 message_;
46 } // namespace extensions
48 #endif // EXTENSIONS_BROWSER_INSTALL_CRX_INSTALL_ERROR_H_