Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / chromeos / app_mode / kiosk_external_update_validator.h
blob09e964db67ceb20e1f47dd5637540a90767f2c9f
1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_
8 #include <string>
10 #include "base/files/file_path.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/sequenced_task_runner.h"
13 #include "extensions/browser/sandboxed_unpacker.h"
15 namespace extensions {
16 class Extension;
19 namespace chromeos {
21 // Delegate class for KioskExternalUpdateValidator, derived class must support
22 // WeakPtr.
23 class KioskExternalUpdateValidatorDelegate {
24 public:
25 virtual void OnExtenalUpdateUnpackSuccess(
26 const std::string& app_id,
27 const std::string& version,
28 const std::string& min_browser_version,
29 const base::FilePath& temp_dir) = 0;
30 virtual void OnExternalUpdateUnpackFailure(const std::string& app_id) = 0;
32 protected:
33 virtual ~KioskExternalUpdateValidatorDelegate() {}
36 // Unpacks the crx file of the kiosk app and validates its signature.
37 class KioskExternalUpdateValidator
38 : public extensions::SandboxedUnpackerClient {
39 public:
40 KioskExternalUpdateValidator(
41 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner,
42 const extensions::CRXFileInfo& file,
43 const base::FilePath& crx_unpack_dir,
44 const base::WeakPtr<KioskExternalUpdateValidatorDelegate>& delegate);
46 // Starts validating the external crx file.
47 void Start();
49 private:
50 ~KioskExternalUpdateValidator() override;
52 // SandboxedUnpackerClient overrides.
53 void OnUnpackFailure(const extensions::CrxInstallError& error) override;
54 void OnUnpackSuccess(const base::FilePath& temp_dir,
55 const base::FilePath& extension_dir,
56 const base::DictionaryValue* original_manifest,
57 const extensions::Extension* extension,
58 const SkBitmap& install_icon) override;
60 // Task runner for executing file I/O tasks.
61 const scoped_refptr<base::SequencedTaskRunner> backend_task_runner_;
63 // Information about the external crx file.
64 extensions::CRXFileInfo crx_file_;
66 // The temporary directory used by SandBoxedUnpacker for unpacking extensions.
67 const base::FilePath crx_unpack_dir_;
69 base::WeakPtr<KioskExternalUpdateValidatorDelegate> delegate_;
71 DISALLOW_COPY_AND_ASSIGN(KioskExternalUpdateValidator);
74 } // namespace chromeos
76 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_