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 #ifndef CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // For example, we can have | 31 // For example, we can have |
32 // text/plain:example.txt:http://example.com/example.txt | 32 // text/plain:example.txt:http://example.com/example.txt |
33 CONTENT_EXPORT bool ParseDownloadMetadata(const string16& metadata, | 33 CONTENT_EXPORT bool ParseDownloadMetadata(const string16& metadata, |
34 string16* mime_type, | 34 string16* mime_type, |
35 FilePath* file_name, | 35 FilePath* file_name, |
36 GURL* url); | 36 GURL* url); |
37 | 37 |
38 // Create a new file at the specified path. If the file already exists, try to | 38 // Create a new file at the specified path. If the file already exists, try to |
39 // insert the sequential unifier to produce a new file, like foo-01.txt. | 39 // insert the sequential unifier to produce a new file, like foo-01.txt. |
40 // Return a FileStream if successful. | 40 // Return a FileStream if successful. |
41 net::FileStream* CreateFileStreamForDrop(FilePath* file_path); | 41 CONTENT_EXPORT net::FileStream* CreateFileStreamForDrop(FilePath* file_path); |
42 | 42 |
43 // Implementation of DownloadFileObserver to finalize the download process. | 43 // Implementation of DownloadFileObserver to finalize the download process. |
44 class PromiseFileFinalizer : public ui::DownloadFileObserver { | 44 class CONTENT_EXPORT PromiseFileFinalizer : public ui::DownloadFileObserver { |
45 public: | 45 public: |
46 explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader); | 46 explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader); |
47 virtual ~PromiseFileFinalizer(); | 47 virtual ~PromiseFileFinalizer(); |
48 | 48 |
49 // DownloadFileObserver methods. | 49 // DownloadFileObserver methods. |
50 virtual void OnDownloadCompleted(const FilePath& file_path); | 50 virtual void OnDownloadCompleted(const FilePath& file_path); |
51 virtual void OnDownloadAborted(); | 51 virtual void OnDownloadAborted(); |
52 | 52 |
53 private: | 53 private: |
54 void Cleanup(); | 54 void Cleanup(); |
55 | 55 |
56 scoped_refptr<DragDownloadFile> drag_file_downloader_; | 56 scoped_refptr<DragDownloadFile> drag_file_downloader_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(PromiseFileFinalizer); | 58 DISALLOW_COPY_AND_ASSIGN(PromiseFileFinalizer); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace drag_download_util | 61 } // namespace drag_download_util |
62 | 62 |
63 #endif // CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ | 63 #endif // CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ |
OLD | NEW |