OLD | NEW |
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 "content/browser/download/base_file.h" | 5 #include "content/browser/download/base_file.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "content/browser/download/download_stats.h" | 13 #include "content/browser/download/download_stats.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/content_browser_client.h" | 15 #include "content/public/browser/content_browser_client.h" |
16 #include "crypto/secure_hash.h" | 16 #include "crypto/secure_hash.h" |
17 #include "net/base/file_stream.h" | 17 #include "net/base/file_stream.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 | 19 |
20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
21 #include <windows.h> | 21 #include <windows.h> |
22 #include <shellapi.h> | 22 #include <shellapi.h> |
23 | 23 |
24 #include "content/browser/safe_util_win.h" | 24 #include "content/browser/safe_util_win.h" |
25 #elif defined(OS_MACOSX) | 25 #elif defined(OS_MACOSX) |
26 #include "content/browser/file_metadata_mac.h" | 26 #include "content/browser/file_metadata_mac.h" |
27 #endif | 27 #endif |
28 | 28 |
| 29 using content::BrowserThread; |
| 30 |
29 namespace { | 31 namespace { |
30 | 32 |
31 #define LOG_ERROR(o, e) LogError(__FILE__, __LINE__, __FUNCTION__, o, e) | 33 #define LOG_ERROR(o, e) LogError(__FILE__, __LINE__, __FUNCTION__, o, e) |
32 | 34 |
33 // Logs the value and passes error on through, converting to a |net::Error|. | 35 // Logs the value and passes error on through, converting to a |net::Error|. |
34 // Returns |ERR_UNEXPECTED| if the value is not in the enum. | 36 // Returns |ERR_UNEXPECTED| if the value is not in the enum. |
35 net::Error LogError(const char* file, int line, const char* func, | 37 net::Error LogError(const char* file, int line, const char* func, |
36 const char* operation, int error) { | 38 const char* operation, int error) { |
37 const char* err_string = ""; | 39 const char* err_string = ""; |
38 net::Error net_error = net::OK; | 40 net::Error net_error = net::OK; |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 std::string BaseFile::DebugString() const { | 455 std::string BaseFile::DebugString() const { |
454 return base::StringPrintf("{ source_url_ = \"%s\"" | 456 return base::StringPrintf("{ source_url_ = \"%s\"" |
455 " full_path_ = \"%" PRFilePath "\"" | 457 " full_path_ = \"%" PRFilePath "\"" |
456 " bytes_so_far_ = %" PRId64 | 458 " bytes_so_far_ = %" PRId64 |
457 " detached_ = %c }", | 459 " detached_ = %c }", |
458 source_url_.spec().c_str(), | 460 source_url_.spec().c_str(), |
459 full_path_.value().c_str(), | 461 full_path_.value().c_str(), |
460 bytes_so_far_, | 462 bytes_so_far_, |
461 detached_ ? 'T' : 'F'); | 463 detached_ ? 'T' : 'F'); |
462 } | 464 } |
OLD | NEW |