Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / dragdrop / download_file_interface.h
blob327fe79ebe190b6e6615d3340b3dbf4427a038ff
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"
15 #if defined(OS_WIN)
16 #include <objidl.h>
17 #endif
19 namespace base {
20 class FilePath;
23 namespace ui {
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> {
30 public:
31 virtual void OnDownloadCompleted(const base::FilePath& file_path) = 0;
32 virtual void OnDownloadAborted() = 0;
34 protected:
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> {
42 public:
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;
53 protected:
54 friend class base::RefCountedThreadSafe<DownloadFileProvider>;
55 virtual ~DownloadFileProvider() {}
58 } // namespace ui
60 #endif // UI_BASE_DRAGDROP_DOWNLOAD_FILE_INTERFACE_H_