- add sources.
[platform/framework/web/crosswalk.git] / src / content / public / browser / download_save_info.h
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_
7
8 #include "base/files/file_path.h"
9 #include "base/memory/linked_ptr.h"
10 #include "content/common/content_export.h"
11 #include "net/base/file_stream.h"
12
13 namespace content {
14
15 // Holds the information about how to save a download file.
16 // In the case of download continuation, |file_path| is set to the current file
17 // name, |offset| is set to the point where we left off, and |hash_state| will
18 // hold the state of the hash algorithm where we left off.
19 struct CONTENT_EXPORT DownloadSaveInfo {
20   DownloadSaveInfo();
21   ~DownloadSaveInfo();
22
23   // If non-empty, contains the full target path of the download that has been
24   // determined prior to download initiation. This is considered to be a trusted
25   // path.
26   base::FilePath file_path;
27
28   // If non-empty, contains an untrusted filename suggestion. This can't contain
29   // a path (only a filename), and is only effective if |file_path| is empty.
30   string16 suggested_name;
31
32   // If non-NULL, contains the source data stream for the file contents.
33   scoped_ptr<net::FileStream> file_stream;
34
35   // The file offset at which to start the download.  May be 0.
36   int64 offset;
37
38   // The state of the hash at the start of the download.  May be empty.
39   std::string hash_state;
40
41   // If |prompt_for_save_location| is true, and |file_path| is empty, then
42   // the user will be prompted for a location to save the download. Otherwise,
43   // the location will be determined automatically using |file_path| as a
44   // basis if |file_path| is not empty.
45   // |prompt_for_save_location| defaults to false.
46   bool prompt_for_save_location;
47
48  private:
49   DISALLOW_COPY_AND_ASSIGN(DownloadSaveInfo);
50 };
51
52 }  // namespace content
53
54 #endif  // CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_