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

Side by Side Diff: chrome/browser/download/download_target_determiner.h

Issue 1982723002: Use FileTypePolicies for download danger classifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use_policies
Patch Set: Fix bad rebase Created 4 years, 7 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/task/cancelable_task_tracker.h" 14 #include "base/task/cancelable_task_tracker.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/download/download_path_reservation_tracker.h" 16 #include "chrome/browser/download/download_path_reservation_tracker.h"
17 #include "chrome/browser/download/download_target_determiner_delegate.h" 17 #include "chrome/browser/download/download_target_determiner_delegate.h"
18 #include "chrome/browser/download/download_target_info.h" 18 #include "chrome/browser/download/download_target_info.h"
19 #include "chrome/common/safe_browsing/download_file_types.pb.h"
19 #include "content/public/browser/download_danger_type.h" 20 #include "content/public/browser/download_danger_type.h"
20 #include "content/public/browser/download_item.h" 21 #include "content/public/browser/download_item.h"
21 #include "content/public/browser/download_manager_delegate.h" 22 #include "content/public/browser/download_manager_delegate.h"
22 23
23 class ChromeDownloadManagerDelegate; 24 class ChromeDownloadManagerDelegate;
24 class Profile; 25 class Profile;
25 class DownloadPrefs; 26 class DownloadPrefs;
26 27
27 namespace content { 28 namespace content {
28 enum DownloadDangerType; 29 enum DownloadDangerType;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // operation. 292 // operation.
292 bool HasPromptedForPath() const; 293 bool HasPromptedForPath() const;
293 294
294 // Returns true if this download should show the "dangerous file" warning. 295 // Returns true if this download should show the "dangerous file" warning.
295 // Various factors are considered, such as the type of the file, whether a 296 // Various factors are considered, such as the type of the file, whether a
296 // user action initiated the download, and whether the user has explicitly 297 // user action initiated the download, and whether the user has explicitly
297 // marked the file type as "auto open". Protected virtual for testing. 298 // marked the file type as "auto open". Protected virtual for testing.
298 // 299 //
299 // If |require_explicit_consent| is non-null then the pointed bool will be set 300 // If |require_explicit_consent| is non-null then the pointed bool will be set
300 // to true if the download requires explicit user consent. 301 // to true if the download requires explicit user consent.
301 download_util::DownloadDangerLevel GetDangerLevel( 302 safe_browsing::DownloadFileType::DangerLevel GetDangerLevel(
302 PriorVisitsToReferrer visits) const; 303 PriorVisitsToReferrer visits) const;
303 304
304 // content::DownloadItem::Observer 305 // content::DownloadItem::Observer
305 void OnDownloadDestroyed(content::DownloadItem* download) override; 306 void OnDownloadDestroyed(content::DownloadItem* download) override;
306 307
307 // state 308 // state
308 State next_state_; 309 State next_state_;
309 bool should_prompt_; 310 bool should_prompt_;
310 bool should_notify_extensions_; 311 bool should_notify_extensions_;
311 bool create_target_directory_; 312 bool create_target_directory_;
312 DownloadPathReservationTracker::FilenameConflictAction conflict_action_; 313 DownloadPathReservationTracker::FilenameConflictAction conflict_action_;
313 content::DownloadDangerType danger_type_; 314 content::DownloadDangerType danger_type_;
314 download_util::DownloadDangerLevel danger_level_; 315 safe_browsing::DownloadFileType::DangerLevel danger_level_;
315 base::FilePath virtual_path_; 316 base::FilePath virtual_path_;
316 base::FilePath local_path_; 317 base::FilePath local_path_;
317 base::FilePath intermediate_path_; 318 base::FilePath intermediate_path_;
318 std::string mime_type_; 319 std::string mime_type_;
319 bool is_filetype_handled_safely_; 320 bool is_filetype_handled_safely_;
320 321
321 content::DownloadItem* download_; 322 content::DownloadItem* download_;
322 const bool is_resumption_; 323 const bool is_resumption_;
323 DownloadPrefs* download_prefs_; 324 DownloadPrefs* download_prefs_;
324 DownloadTargetDeterminerDelegate* delegate_; 325 DownloadTargetDeterminerDelegate* delegate_;
325 CompletionCallback completion_callback_; 326 CompletionCallback completion_callback_;
326 base::CancelableTaskTracker history_tracker_; 327 base::CancelableTaskTracker history_tracker_;
327 328
328 base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_; 329 base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_;
329 330
330 DISALLOW_COPY_AND_ASSIGN(DownloadTargetDeterminer); 331 DISALLOW_COPY_AND_ASSIGN(DownloadTargetDeterminer);
331 }; 332 };
332 333
333 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ 334 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_prefs_unittest.cc ('k') | chrome/browser/download/download_target_determiner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698