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

Side by Side Diff: chrome/common/zip_reader.cc

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright issue. Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/zip.cc ('k') | content/browser/download/base_file.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/zip_reader.h" 5 #include "chrome/common/zip_reader.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/common/zip_internal.h" 11 #include "chrome/common/zip_internal.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const int open_result = unzOpenCurrentFile(zip_file_); 183 const int open_result = unzOpenCurrentFile(zip_file_);
184 if (open_result != UNZ_OK) 184 if (open_result != UNZ_OK)
185 return false; 185 return false;
186 186
187 // We can't rely on parent directory entries being specified in the 187 // We can't rely on parent directory entries being specified in the
188 // zip, so we make sure they are created. 188 // zip, so we make sure they are created.
189 FilePath output_dir_path = output_file_path.DirName(); 189 FilePath output_dir_path = output_file_path.DirName();
190 if (!file_util::CreateDirectory(output_dir_path)) 190 if (!file_util::CreateDirectory(output_dir_path))
191 return false; 191 return false;
192 192
193 net::FileStream stream; 193 net::FileStream stream(NULL);
194 const int flags = (base::PLATFORM_FILE_CREATE_ALWAYS | 194 const int flags = (base::PLATFORM_FILE_CREATE_ALWAYS |
195 base::PLATFORM_FILE_WRITE); 195 base::PLATFORM_FILE_WRITE);
196 if (stream.Open(output_file_path, flags) != 0) 196 if (stream.Open(output_file_path, flags) != 0)
197 return false; 197 return false;
198 198
199 bool success = true; // This becomes false when something bad happens. 199 bool success = true; // This becomes false when something bad happens.
200 while (true) { 200 while (true) {
201 char buf[internal::kZipBufSize]; 201 char buf[internal::kZipBufSize];
202 const int num_bytes_read = unzReadCurrentFile(zip_file_, buf, 202 const int num_bytes_read = unzReadCurrentFile(zip_file_, buf,
203 internal::kZipBufSize); 203 internal::kZipBufSize);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 290
291 void ZipReader::Reset() { 291 void ZipReader::Reset() {
292 zip_file_ = NULL; 292 zip_file_ = NULL;
293 num_entries_ = 0; 293 num_entries_ = 0;
294 reached_end_ = false; 294 reached_end_ = false;
295 current_entry_info_.reset(); 295 current_entry_info_.reset();
296 } 296 }
297 297
298 } // namespace zip 298 } // namespace zip
OLDNEW
« no previous file with comments | « chrome/common/zip.cc ('k') | content/browser/download/base_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698