| OLD | NEW |
| 1 // Copyright (c) 2012 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 "content/browser/download/drag_download_util.h" | 5 #include "content/browser/download/drag_download_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 std::string suffix = std::string("-") + base::IntToString(seq); | 75 std::string suffix = std::string("-") + base::IntToString(seq); |
| 76 #endif | 76 #endif |
| 77 new_file_path = file_path->InsertBeforeExtension(suffix); | 77 new_file_path = file_path->InsertBeforeExtension(suffix); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // http://crbug.com/110709 | 80 // http://crbug.com/110709 |
| 81 base::ThreadRestrictions::ScopedAllowIO allow_io; | 81 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 82 | 82 |
| 83 // Explicitly (and redundantly check) for file -- despite the fact that our | 83 // Explicitly (and redundantly check) for file -- despite the fact that our |
| 84 // open won't overwrite -- just to avoid log spew. | 84 // open won't overwrite -- just to avoid log spew. |
| 85 if (!file_util::PathExists(new_file_path) && | 85 if (!base::PathExists(new_file_path) && |
| 86 file_stream->OpenSync(new_file_path, base::PLATFORM_FILE_CREATE | | 86 file_stream->OpenSync(new_file_path, base::PLATFORM_FILE_CREATE | |
| 87 base::PLATFORM_FILE_WRITE) == net::OK) { | 87 base::PLATFORM_FILE_WRITE) == net::OK) { |
| 88 *file_path = new_file_path; | 88 *file_path = new_file_path; |
| 89 return file_stream.release(); | 89 return file_stream.release(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 return NULL; | 93 return NULL; |
| 94 } | 94 } |
| 95 | 95 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 PromiseFileFinalizer::~PromiseFileFinalizer() {} | 114 PromiseFileFinalizer::~PromiseFileFinalizer() {} |
| 115 | 115 |
| 116 void PromiseFileFinalizer::Cleanup() { | 116 void PromiseFileFinalizer::Cleanup() { |
| 117 if (drag_file_downloader_.get()) | 117 if (drag_file_downloader_.get()) |
| 118 drag_file_downloader_ = NULL; | 118 drag_file_downloader_ = NULL; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace content | 121 } // namespace content |
| OLD | NEW |