summaryrefslogtreecommitdiffstats
path: root/content/browser/download/download_state_info.h
blob: 7392e634511c079f00ec6bca413898e0d15f95a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_
#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_
#pragma once

#include "base/file_path.h"
#include "content/common/page_transition_types.h"

// Contains information relating to the process of determining what to do with
// the download.
struct DownloadStateInfo {
  DownloadStateInfo();
  DownloadStateInfo(bool has_user_gesture,
                    bool prompt_user_for_save_location);
  DownloadStateInfo(const FilePath& target,
                    const FilePath& forced_name,
                    bool has_user_gesture,
                    PageTransition::Type transition_type,
                    bool prompt_user_for_save_location,
                    int uniquifier,
                    bool dangerous_file,
                    bool dangerous_url);

  // Indicates if the download is dangerous.
  bool IsDangerous() const;

  // The original name for a dangerous download, specified by the request.
  FilePath target_name;

  // The path where we save the download.  Typically generated.
  FilePath suggested_path;

  // A number that should be added to the suggested path to make it unique.
  // 0 means no number should be appended.  It is eventually incorporated
  // into the final file name.
  int path_uniquifier;

  // True if the download is the result of user action.
  bool has_user_gesture;

  PageTransition::Type transition_type;

  // True if we should display the 'save as...' UI and prompt the user
  // for the download location.
  // False if the UI should be suppressed and the download performed to the
  // default location.
  bool prompt_user_for_save_location;

  // True if this download file is potentially dangerous (ex: exe, dll, ...).
  bool is_dangerous_file;

  // If safebrowsing believes this URL leads to malware.
  bool is_dangerous_url;

  // True if this download's file name was specified initially.
  FilePath force_file_name;
};

#endif  // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_