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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_
6 #define UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_
8 #include "build/build_config.h"
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
13 #include "ui/base/ui_base_export.h"
25 // TODO(benjhayden, anybody): Do these need to be RefCountedThreadSafe?
27 // Defines the interface to observe the status of file download.
28 class UI_BASE_EXPORT DownloadFileObserver
29 : public base::RefCountedThreadSafe
<DownloadFileObserver
> {
31 virtual void OnDownloadCompleted(const base::FilePath
& file_path
) = 0;
32 virtual void OnDownloadAborted() = 0;
35 friend class base::RefCountedThreadSafe
<DownloadFileObserver
>;
36 virtual ~DownloadFileObserver() {}
39 // Defines the interface to control how a file is downloaded.
40 class UI_BASE_EXPORT DownloadFileProvider
41 : public base::RefCountedThreadSafe
<DownloadFileProvider
> {
43 // Starts the download asynchronously and returns immediately.
44 virtual void Start(DownloadFileObserver
* observer
) = 0;
46 // Returns true if the download succeeded and false otherwise. Waits until the
47 // download is completed/cancelled/interrupted before returning.
48 virtual bool Wait() = 0;
50 // Cancels the download.
51 virtual void Stop() = 0;
54 friend class base::RefCountedThreadSafe
<DownloadFileProvider
>;
55 virtual ~DownloadFileProvider() {}
60 #endif // UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_