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 #ifndef CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "content/browser/download/download_file.h" | 12 #include "content/browser/download/download_file.h" |
13 #include "content/common/content_export.h" | |
14 #include "content/public/browser/download_item.h" | 13 #include "content/public/browser/download_item.h" |
15 #include "content/public/browser/download_manager.h" | 14 #include "content/public/browser/download_manager.h" |
16 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
17 #include "net/base/file_stream.h" | 16 #include "net/base/file_stream.h" |
18 #include "ui/base/dragdrop/download_file_interface.h" | 17 #include "ui/base/dragdrop/download_file_interface.h" |
19 #include "ui/base/ui_export.h" | 18 #include "ui/base/ui_export.h" |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 class DownloadManager; | 21 class DownloadManager; |
23 class WebContents; | 22 class WebContents; |
24 } | 23 } |
25 | 24 |
26 namespace net { | 25 namespace net { |
27 class FileStream; | 26 class FileStream; |
28 } | 27 } |
29 | 28 |
30 class CONTENT_EXPORT DragDownloadFile | 29 class DragDownloadFile |
31 : public ui::DownloadFileProvider, | 30 : public ui::DownloadFileProvider, |
32 public content::DownloadManager::Observer, | 31 public content::DownloadManager::Observer, |
33 public content::DownloadItem::Observer { | 32 public content::DownloadItem::Observer { |
34 public: | 33 public: |
35 // On Windows, we need to download into a temporary file. Two threads are | 34 // On Windows, we need to download into a temporary file. Two threads are |
36 // involved: background drag-and-drop thread and UI thread. | 35 // involved: background drag-and-drop thread and UI thread. |
37 // The first parameter file_name_or_path should contain file name while the | 36 // The first parameter file_name_or_path should contain file name while the |
38 // second parameter file_stream should be NULL. | 37 // second parameter file_stream should be NULL. |
39 // | 38 // |
40 // On MacOSX, we need to download into a file stream that has already been | 39 // On MacOSX, we need to download into a file stream that has already been |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 113 |
115 // Access on UI thread. | 114 // Access on UI thread. |
116 content::DownloadManager* download_manager_; | 115 content::DownloadManager* download_manager_; |
117 bool download_manager_observer_added_; | 116 bool download_manager_observer_added_; |
118 content::DownloadItem* download_item_; | 117 content::DownloadItem* download_item_; |
119 | 118 |
120 DISALLOW_COPY_AND_ASSIGN(DragDownloadFile); | 119 DISALLOW_COPY_AND_ASSIGN(DragDownloadFile); |
121 }; | 120 }; |
122 | 121 |
123 #endif // CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_H_ | 122 #endif // CONTENT_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_H_ |
OLD | NEW |