Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Side by Side Diff: content/browser/download/download_state_info.h

Issue 8468020: Propagate the SafeBrowsing download protection verdict to the DownloadItem. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix typo Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/public/common/page_transition_types.h" 11 #include "content/public/common/page_transition_types.h"
12 12
13 // Contains information relating to the process of determining what to do with 13 // Contains information relating to the process of determining what to do with
14 // the download. 14 // the download.
15 struct DownloadStateInfo { 15 struct DownloadStateInfo {
16 // This enum is also used by histograms. Do not change the ordering or remove
17 // items.
18 enum DangerType {
Randy Smith (Not in Mondays) 2011/11/17 16:49:31 Given the choice, I'd rather this enum was in Down
noelutz 2011/11/17 17:05:44 I thought of that but then you have a circular inc
19 // The download is safe.
20 NOT_DANGEROUS = 0,
21
22 // A dangerous file to the system (e.g.: a pdf or extension from
23 // places other than gallery).
24 DANGEROUS_FILE,
25
26 // Safebrowsing download service shows this URL leads to malicious file
27 // download.
28 DANGEROUS_URL,
29
30 // SafeBrowsing download service shows this file content as being malicious.
31 DANGEROUS_CONTENT,
32
33 // The content of this download may be malicious (e.g., extension is exe but
34 // SafeBrowsing has not finished checking the content).
35 MAYBE_DANGEROUS_CONTENT,
36
37 // Memory space for histograms is determined by the max.
38 // ALWAYS ADD NEW VALUES BEFORE THIS ONE.
39 DANGEROUS_TYPE_MAX
40 };
41
16 DownloadStateInfo(); 42 DownloadStateInfo();
17 DownloadStateInfo(bool has_user_gesture, 43 DownloadStateInfo(bool has_user_gesture,
18 bool prompt_user_for_save_location); 44 bool prompt_user_for_save_location);
19 DownloadStateInfo(const FilePath& target, 45 DownloadStateInfo(const FilePath& target,
20 const FilePath& forced_name, 46 const FilePath& forced_name,
21 bool has_user_gesture, 47 bool has_user_gesture,
22 content::PageTransition transition_type, 48 content::PageTransition transition_type,
23 bool prompt_user_for_save_location, 49 bool prompt_user_for_save_location,
24 int uniquifier, 50 int uniquifier,
25 bool dangerous_file, 51 DangerType danger);
26 bool dangerous_url);
27 52
28 // Indicates if the download is dangerous. 53 // Indicates if the download is dangerous.
29 CONTENT_EXPORT bool IsDangerous() const; 54 CONTENT_EXPORT bool IsDangerous() const;
30 55
31 // The original name for a dangerous download, specified by the request. 56 // The original name for a dangerous download, specified by the request.
32 FilePath target_name; 57 FilePath target_name;
33 58
34 // The path where we save the download. Typically generated. 59 // The path where we save the download. Typically generated.
35 FilePath suggested_path; 60 FilePath suggested_path;
36 61
37 // A number that should be added to the suggested path to make it unique. 62 // A number that should be added to the suggested path to make it unique.
38 // 0 means no number should be appended. It is eventually incorporated 63 // 0 means no number should be appended. It is eventually incorporated
39 // into the final file name. 64 // into the final file name.
40 int path_uniquifier; 65 int path_uniquifier;
41 66
42 // True if the download is the result of user action. 67 // True if the download is the result of user action.
43 bool has_user_gesture; 68 bool has_user_gesture;
44 69
45 content::PageTransition transition_type; 70 content::PageTransition transition_type;
46 71
47 // True if we should display the 'save as...' UI and prompt the user 72 // True if we should display the 'save as...' UI and prompt the user
48 // for the download location. 73 // for the download location.
49 // False if the UI should be suppressed and the download performed to the 74 // False if the UI should be suppressed and the download performed to the
50 // default location. 75 // default location.
51 bool prompt_user_for_save_location; 76 bool prompt_user_for_save_location;
52 77
53 // True if this download file is potentially dangerous (ex: exe, dll, ...). 78 DangerType danger;
54 bool is_dangerous_file;
55
56 // If safebrowsing believes this URL leads to malware.
57 bool is_dangerous_url;
58 79
59 // True if this download's file name was specified initially. 80 // True if this download's file name was specified initially.
60 FilePath force_file_name; 81 FilePath force_file_name;
61 }; 82 };
62 83
63 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ 84 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_item.cc ('k') | content/browser/download/download_state_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698