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 #include "mojo/tools/package_manager/unpacker.h"
7 #include "base/files/file_util.h"
8 #include "base/logging.h"
9 #include "third_party/zlib/google/zip.h"
13 Unpacker::Unpacker() {
16 Unpacker::~Unpacker() {
18 DeleteFile(dir_, true);
21 bool Unpacker::Unpack(const base::FilePath& zip_file) {
22 DCHECK(zip_file_.empty());
26 if (!CreateNewTempDirectory(base::FilePath::StringType(), &dir_))
28 if (!zip::Unzip(zip_file, dir_)) {
29 dir_ = base::FilePath();