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 UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_ | 5 #ifndef UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_ |
6 #define UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_ | 6 #define UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 namespace ui { | 23 namespace ui { |
24 | 24 |
25 // TODO(benjhayden, anybody): Do these need to be RefCountedThreadSafe? | 25 // TODO(benjhayden, anybody): Do these need to be RefCountedThreadSafe? |
26 | 26 |
27 // Defines the interface to observe the status of file download. | 27 // Defines the interface to observe the status of file download. |
28 class UI_EXPORT DownloadFileObserver | 28 class UI_EXPORT DownloadFileObserver |
29 : public base::RefCountedThreadSafe<DownloadFileObserver> { | 29 : public base::RefCountedThreadSafe<DownloadFileObserver> { |
30 public: | 30 public: |
31 virtual void OnDownloadCompleted(const FilePath& file_path) = 0; | 31 virtual void OnDownloadCompleted(const base::FilePath& file_path) = 0; |
32 virtual void OnDownloadAborted() = 0; | 32 virtual void OnDownloadAborted() = 0; |
33 | 33 |
34 protected: | 34 protected: |
35 friend class base::RefCountedThreadSafe<DownloadFileObserver>; | 35 friend class base::RefCountedThreadSafe<DownloadFileObserver>; |
36 virtual ~DownloadFileObserver() {} | 36 virtual ~DownloadFileObserver() {} |
37 }; | 37 }; |
38 | 38 |
39 // Defines the interface to control how a file is downloaded. | 39 // Defines the interface to control how a file is downloaded. |
40 class UI_EXPORT DownloadFileProvider | 40 class UI_EXPORT DownloadFileProvider |
41 : public base::RefCountedThreadSafe<DownloadFileProvider> { | 41 : public base::RefCountedThreadSafe<DownloadFileProvider> { |
42 public: | 42 public: |
43 // Starts the download asynchronously and returns immediately. | 43 // Starts the download asynchronously and returns immediately. |
44 virtual void Start(DownloadFileObserver* observer) = 0; | 44 virtual void Start(DownloadFileObserver* observer) = 0; |
45 | 45 |
46 // Returns true if the download succeeded and false otherwise. Waits until the | 46 // Returns true if the download succeeded and false otherwise. Waits until the |
47 // download is completed/cancelled/interrupted before returning. | 47 // download is completed/cancelled/interrupted before returning. |
48 virtual bool Wait() = 0; | 48 virtual bool Wait() = 0; |
49 | 49 |
50 // Cancels the download. | 50 // Cancels the download. |
51 virtual void Stop() = 0; | 51 virtual void Stop() = 0; |
52 | 52 |
53 protected: | 53 protected: |
54 friend class base::RefCountedThreadSafe<DownloadFileProvider>; | 54 friend class base::RefCountedThreadSafe<DownloadFileProvider>; |
55 virtual ~DownloadFileProvider() {} | 55 virtual ~DownloadFileProvider() {} |
56 }; | 56 }; |
57 | 57 |
58 } // namespace ui | 58 } // namespace ui |
59 | 59 |
60 #endif // UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_ | 60 #endif // UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_ |
OLD | NEW |