mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add password argument to CefZipArchive::Load (issue #986).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1277 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -86,11 +86,14 @@ class CefZipArchive : public CefBase {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// Load the contents of the specified zip archive stream into this object.
|
// Load the contents of the specified zip archive stream into this object.
|
||||||
|
// If the zip archive requires a password then provide it via |password|.
|
||||||
// If |overwriteExisting| is true then any files in this object that also
|
// If |overwriteExisting| is true then any files in this object that also
|
||||||
// exist in the specified archive will be replaced with the new files.
|
// exist in the specified archive will be replaced with the new files.
|
||||||
// Returns the number of files successfully loaded.
|
// Returns the number of files successfully loaded.
|
||||||
///
|
///
|
||||||
size_t Load(CefRefPtr<CefStreamReader> stream, bool overwriteExisting);
|
size_t Load(CefRefPtr<CefStreamReader> stream,
|
||||||
|
const CefString& password,
|
||||||
|
bool overwriteExisting);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Clears the contents of this object.
|
// Clears the contents of this object.
|
||||||
|
@@ -53,6 +53,7 @@ CefZipArchive::~CefZipArchive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
|
size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
|
||||||
|
const CefString& password,
|
||||||
bool overwriteExisting) {
|
bool overwriteExisting) {
|
||||||
AutoLock lock_scope(this);
|
AutoLock lock_scope(this);
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reader->OpenFile(CefString()))
|
if (!reader->OpenFile(password))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
name = reader->GetFileName();
|
name = reader->GetFileName();
|
||||||
|
@@ -221,7 +221,7 @@ TEST(ZipReaderTest, ReadArchive) {
|
|||||||
// Create the Zip archive object.
|
// Create the Zip archive object.
|
||||||
CefRefPtr<CefZipArchive> archive(new CefZipArchive());
|
CefRefPtr<CefZipArchive> archive(new CefZipArchive());
|
||||||
|
|
||||||
ASSERT_EQ(archive->Load(stream, false), (size_t)5);
|
ASSERT_EQ(archive->Load(stream, CefString(), false), (size_t)5);
|
||||||
|
|
||||||
ASSERT_TRUE(archive->HasFile("test_archive/file 1.txt"));
|
ASSERT_TRUE(archive->HasFile("test_archive/file 1.txt"));
|
||||||
ASSERT_TRUE(archive->HasFile("test_archive/folder 1/file 1a.txt"));
|
ASSERT_TRUE(archive->HasFile("test_archive/folder 1/file 1a.txt"));
|
||||||
|
Reference in New Issue
Block a user