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:
Marshall Greenblatt 2013-06-10 18:23:48 +00:00
parent a135b46e2c
commit ca3a2da5ee
3 changed files with 7 additions and 3 deletions

View File

@ -86,11 +86,14 @@ class CefZipArchive : public CefBase {
///
// 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
// exist in the specified archive will be replaced with the new files.
// 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.

View File

@ -53,6 +53,7 @@ CefZipArchive::~CefZipArchive() {
}
size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
const CefString& password,
bool overwriteExisting) {
AutoLock lock_scope(this);
@ -76,7 +77,7 @@ size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
continue;
}
if (!reader->OpenFile(CefString()))
if (!reader->OpenFile(password))
break;
name = reader->GetFileName();

View File

@ -221,7 +221,7 @@ TEST(ZipReaderTest, ReadArchive) {
// Create the Zip archive object.
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/folder 1/file 1a.txt"));