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.
4
5#ifndef MOJO_TOOLS_PACKAGE_MANAGER_UNPACKER_H_
6#define MOJO_TOOLS_PACKAGE_MANAGER_UNPACKER_H_
7
8#include "base/files/file_path.h"
9#include "base/memory/ref_counted.h"
10#include "mojo/public/cpp/system/macros.h"
11
12namespace mojo {
13
14// Unzips a package into a temporary folder. The temporary folder will be
15// deleted when the object is destroyed.
16//
17// In the future, this class would probably manage doing the unzip operation on
18// a background thread.
19class Unpacker {
20 public:
21  Unpacker();
22  ~Unpacker();
23
24  // Actually does the unpacking, returns true on success.
25  bool Unpack(const base::FilePath& zip_file);
26
27  // The root directory where the package has been unpacked.
28  const base::FilePath& dir() const { return dir_; }
29
30 private:
31  base::FilePath zip_file_;
32
33  base::FilePath dir_;
34
35  MOJO_DISALLOW_COPY_AND_ASSIGN(Unpacker);
36};
37
38}  // namespace mojo
39
40#endif  // MOJO_TOOLS_PACKAGE_MANAGER_UNPACKER_H_
41