Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(936)

Side by Side Diff: ui/file_manager/zip_archiver/unpacker/cpp/compressor_archive_libarchive.h

Issue 2804453002: Move files from zip_archiver/unpacker/ to zip_archiver/. (Closed)
Patch Set: Move files from zip_archiver/unpacker/ to zip_archiver/. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium OS 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 COMPRESSOR_ARCHIVE_LIBARCHIVE_H_
6 #define COMPRESSOR_ARCHIVE_LIBARCHIVE_H_
7
8 #include <string>
9
10 #include "archive.h"
11
12 #include "compressor_archive.h"
13 #include "compressor_stream.h"
14
15 // A namespace with constants used by CompressorArchiveLibarchive.
16 namespace compressor_archive_constants {
17 const int64_t kMaximumDataChunkSize = 512 * 1024;
18 const int kFilePermission = 640;
19 const int kDirectoryPermission = 760;
20 } // namespace compressor_archive_constants
21
22 class CompressorArchiveLibarchive : public CompressorArchive {
23 public:
24 explicit CompressorArchiveLibarchive(CompressorStream* compressor_stream);
25
26 virtual ~CompressorArchiveLibarchive();
27
28 // Creates an archive object.
29 virtual void CreateArchive();
30
31 // Releases all resources obtained by libarchive.
32 virtual void CloseArchive(bool has_error);
33
34 // Adds an entry to the archive.
35 virtual void AddToArchive(const std::string& filename,
36 int64_t file_size,
37 time_t modification_time,
38 bool is_directory);
39
40 // A getter function for archive_.
41 struct archive* archive() const { return archive_; }
42
43 // A getter function for compressor_stream.
44 CompressorStream* compressor_stream() const { return compressor_stream_; }
45
46 private:
47 // An instance that takes care of all IO operations.
48 CompressorStream* compressor_stream_;
49
50 // The libarchive correspondent archive object.
51 struct archive* archive_;
52
53 // The libarchive correspondent archive entry object that is currently
54 // processed.
55 struct archive_entry* entry;
56
57 // The buffer used to store the data read from JavaScript.
58 char* destination_buffer_;
59 };
60
61 #endif // COMPRESSOR_ARCHIVE_LIBARCHIVE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698