| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "app/download_file_interface.h" | 9 #include "app/download_file_interface.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 GURL* url); | 35 GURL* url); |
| 36 | 36 |
| 37 // Create a new file at the specified path. If the file already exists, try to | 37 // Create a new file at the specified path. If the file already exists, try to |
| 38 // insert the sequential unifier to produce a new file, like foo-01.txt. | 38 // insert the sequential unifier to produce a new file, like foo-01.txt. |
| 39 // Return a FileStream if successful. | 39 // Return a FileStream if successful. |
| 40 net::FileStream* CreateFileStreamForDrop(FilePath* file_path); | 40 net::FileStream* CreateFileStreamForDrop(FilePath* file_path); |
| 41 | 41 |
| 42 // Implementation of DownloadFileObserver to finalize the download process. | 42 // Implementation of DownloadFileObserver to finalize the download process. |
| 43 class PromiseFileFinalizer : public DownloadFileObserver { | 43 class PromiseFileFinalizer : public DownloadFileObserver { |
| 44 public: | 44 public: |
| 45 explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader) | 45 explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader); |
| 46 : drag_file_downloader_(drag_file_downloader) { | 46 virtual ~PromiseFileFinalizer(); |
| 47 } | |
| 48 virtual ~PromiseFileFinalizer() { } | |
| 49 | 47 |
| 50 // DownloadFileObserver methods. | 48 // DownloadFileObserver methods. |
| 51 virtual void OnDownloadCompleted(const FilePath& file_path); | 49 virtual void OnDownloadCompleted(const FilePath& file_path); |
| 52 virtual void OnDownloadAborted(); | 50 virtual void OnDownloadAborted(); |
| 53 | 51 |
| 54 private: | 52 private: |
| 55 void Cleanup(); | 53 void Cleanup(); |
| 56 | 54 |
| 57 scoped_refptr<DragDownloadFile> drag_file_downloader_; | 55 scoped_refptr<DragDownloadFile> drag_file_downloader_; |
| 58 | 56 |
| 59 DISALLOW_COPY_AND_ASSIGN(PromiseFileFinalizer); | 57 DISALLOW_COPY_AND_ASSIGN(PromiseFileFinalizer); |
| 60 }; | 58 }; |
| 61 | 59 |
| 62 } // namespace drag_download_util | 60 } // namespace drag_download_util |
| 63 | 61 |
| 64 #endif // CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ | 62 #endif // CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ |
| OLD | NEW |