WebKit Roll 56306:56312.
[chromium-blink-merge.git] / app / download_file_interface.h
blob13d2dcf178deeafffd279aa936e878b2bf6c8b98
1 // Copyright (c) 2009 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 APP_DOWNLOAD_FILE_INTERFACE_H_
6 #define APP_DOWNLOAD_FILE_INTERFACE_H_
8 #include "build/build_config.h"
10 #include "base/basictypes.h"
11 #include "base/ref_counted.h"
13 #if defined(OS_WIN)
14 #include <objidl.h>
15 #endif
17 class FilePath;
19 // Defines the interface to observe the status of file download.
20 class DownloadFileObserver
21 : public base::RefCountedThreadSafe<DownloadFileObserver> {
22 public:
23 virtual void OnDownloadCompleted(const FilePath& file_path) = 0;
24 virtual void OnDownloadAborted() = 0;
26 protected:
27 friend class base::RefCountedThreadSafe<DownloadFileObserver>;
28 virtual ~DownloadFileObserver() {}
31 // Defines the interface to control how a file is downloaded.
32 class DownloadFileProvider
33 : public base::RefCountedThreadSafe<DownloadFileProvider> {
34 public:
35 virtual bool Start(DownloadFileObserver* observer) = 0;
36 virtual void Stop() = 0;
37 #if defined(OS_WIN)
38 virtual IStream* GetStream() = 0;
39 #endif
41 protected:
42 friend class base::RefCountedThreadSafe<DownloadFileProvider>;
43 virtual ~DownloadFileProvider() {}
46 #endif // APP_DOWNLOAD_FILE_INTERFACE_H_