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

Side by Side Diff: chrome/browser/download/base_file.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixes comments by eroman Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/download/base_file.h ('k') | chrome/browser/enumerate_modules_model_win.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) 2011 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/browser/download/base_file.h" 5 #include "chrome/browser/download/base_file.h"
6 6
7 #include "base/crypto/secure_hash.h"
8 #include "base/file_util.h" 7 #include "base/file_util.h"
9 #include "base/format_macros.h" 8 #include "base/format_macros.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "crypto/secure_hash.h"
12 #include "net/base/file_stream.h" 12 #include "net/base/file_stream.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "chrome/browser/download/download_util.h" 14 #include "chrome/browser/download/download_util.h"
15 #include "content/browser/browser_thread.h" 15 #include "content/browser/browser_thread.h"
16 16
17 #if defined(OS_WIN) 17 #if defined(OS_WIN)
18 #include "chrome/common/win_safe_util.h" 18 #include "chrome/common/win_safe_util.h"
19 #elif defined(OS_MACOSX) 19 #elif defined(OS_MACOSX)
20 #include "chrome/browser/cocoa/file_metadata.h" 20 #include "chrome/browser/cocoa/file_metadata.h"
21 #endif 21 #endif
(...skipping 23 matching lines...) Expand all
45 Cancel(); // Will delete the file. 45 Cancel(); // Will delete the file.
46 } 46 }
47 47
48 bool BaseFile::Initialize(bool calculate_hash) { 48 bool BaseFile::Initialize(bool calculate_hash) {
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
50 DCHECK(!detached_); 50 DCHECK(!detached_);
51 51
52 calculate_hash_ = calculate_hash; 52 calculate_hash_ = calculate_hash;
53 53
54 if (calculate_hash_) 54 if (calculate_hash_)
55 secure_hash_.reset(base::SecureHash::Create(base::SecureHash::SHA256)); 55 secure_hash_.reset(crypto::SecureHash::Create(crypto::SecureHash::SHA256));
56 56
57 if (!full_path_.empty() || 57 if (!full_path_.empty() ||
58 download_util::CreateTemporaryFileForDownload(&full_path_)) 58 download_util::CreateTemporaryFileForDownload(&full_path_))
59 return Open(); 59 return Open();
60 return false; 60 return false;
61 } 61 }
62 62
63 bool BaseFile::AppendDataToFile(const char* data, size_t data_len) { 63 bool BaseFile::AppendDataToFile(const char* data, size_t data_len) {
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
65 DCHECK(!detached_); 65 DCHECK(!detached_);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 std::string BaseFile::DebugString() const { 238 std::string BaseFile::DebugString() const {
239 return base::StringPrintf("{ source_url_ = \"%s\"" 239 return base::StringPrintf("{ source_url_ = \"%s\""
240 " full_path_ = \"%" PRFilePath "\"" 240 " full_path_ = \"%" PRFilePath "\""
241 " bytes_so_far_ = %" PRId64 " detached_ = %c }", 241 " bytes_so_far_ = %" PRId64 " detached_ = %c }",
242 source_url_.spec().c_str(), 242 source_url_.spec().c_str(),
243 full_path_.value().c_str(), 243 full_path_.value().c_str(),
244 bytes_so_far_, 244 bytes_so_far_,
245 detached_ ? 'T' : 'F'); 245 detached_ ? 'T' : 'F');
246 } 246 }
OLDNEW
« no previous file with comments | « chrome/browser/download/base_file.h ('k') | chrome/browser/enumerate_modules_model_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698