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

Unified Diff: trunk/src/chrome/browser/download/download_target_determiner.h

Issue 61623006: Revert 233460 "Prefer opening PDF downloads in the browser." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/download/download_target_determiner.h
===================================================================
--- trunk/src/chrome/browser/download/download_target_determiner.h (revision 233496)
+++ trunk/src/chrome/browser/download/download_target_determiner.h (working copy)
@@ -12,7 +12,6 @@
#include "chrome/browser/common/cancelable_request.h"
#include "chrome/browser/download/download_path_reservation_tracker.h"
#include "chrome/browser/download/download_target_determiner_delegate.h"
-#include "chrome/browser/download/download_target_info.h"
#include "content/public/browser/download_danger_type.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager_delegate.h"
@@ -51,9 +50,6 @@
class DownloadTargetDeterminer
: public content::DownloadItem::Observer {
public:
- typedef base::Callback<void(scoped_ptr<DownloadTargetInfo>)>
- CompletionCallback;
-
// Start the process of determing the target of |download|.
//
// |initial_virtual_path| if non-empty, defines the initial virtual path for
@@ -74,7 +70,7 @@
const base::FilePath& initial_virtual_path,
DownloadPrefs* download_prefs,
DownloadTargetDeterminerDelegate* delegate,
- const CompletionCallback& callback);
+ const content::DownloadTargetCallback& callback);
// Returns a .crdownload intermediate path for the |suggested_path|.
static base::FilePath GetCrDownloadPath(const base::FilePath& suggested_path);
@@ -91,8 +87,6 @@
STATE_RESERVE_VIRTUAL_PATH,
STATE_PROMPT_USER_FOR_DOWNLOAD_PATH,
STATE_DETERMINE_LOCAL_PATH,
- STATE_DETERMINE_MIME_TYPE,
- STATE_DETERMINE_IF_HANDLED_BY_BROWSER,
STATE_CHECK_DOWNLOAD_URL,
STATE_CHECK_VISITED_REFERRER_BEFORE,
STATE_DETERMINE_INTERMEDIATE_PATH,
@@ -125,11 +119,12 @@
// Construct a DownloadTargetDeterminer object. Constraints on the arguments
// are as per Start() above.
- DownloadTargetDeterminer(content::DownloadItem* download,
- const base::FilePath& initial_virtual_path,
- DownloadPrefs* download_prefs,
- DownloadTargetDeterminerDelegate* delegate,
- const CompletionCallback& callback);
+ DownloadTargetDeterminer(
+ content::DownloadItem* download,
+ const base::FilePath& initial_virtual_path,
+ DownloadPrefs* download_prefs,
+ DownloadTargetDeterminerDelegate* delegate,
+ const content::DownloadTargetCallback& callback);
virtual ~DownloadTargetDeterminer();
@@ -183,39 +178,12 @@
// virtual path. The translation is done by invoking the DetermineLocalPath()
// method on the delegate.
// Next state:
- // - STATE_DETERMINE_MIME_TYPE.
+ // - STATE_CHECK_DOWNLOAD_URL.
Result DoDetermineLocalPath();
// Callback invoked when the delegate has determined local path.
void DetermineLocalPathDone(const base::FilePath& local_path);
- // Determine the MIME type corresponding to the local file path. This is only
- // done if the local path and the virtual path was the same. I.e. The file is
- // intended for the local file system. This restriction is there because the
- // resulting MIME type is only valid for determining whether the browser can
- // handle the download if it were opened via a file:// URL.
- // Next state:
- // - STATE_DETERMINE_IF_HANDLED_BY_BROWSER.
- Result DoDetermineMimeType();
-
- // Callback invoked when the MIME type is available. Since determination of
- // the MIME type can involve disk access, it is done in the blocking pool.
- void DetermineMimeTypeDone(const std::string& mime_type);
-
- // Determine if the file type can be handled by the browser if it were to be
- // opened via a file:// URL.
- // Next state:
- // - STATE_CHECK_DOWNLOAD_URL.
- Result DoDetermineIfHandledByBrowser();
-
- // Callback invoked when a decision is available about whether the file type
- // can be handled by the browser. The actual decision depends on the profile
- // and has to be made on the UI thread. Therefore this method receives a
- // callback that can determine whether the download is handled by the browser
- // based on a passed-in Profile* parameter.
- void DetermineIfHandledByBrowserDone(
- const base::Callback<bool(Profile*)>& per_profile_handler_checker);
-
// Checks whether the downloaded URL is malicious. Invokes the
// DownloadProtectionService via the delegate.
// Next state:
@@ -289,14 +257,12 @@
base::FilePath virtual_path_;
base::FilePath local_path_;
base::FilePath intermediate_path_;
- std::string mime_type_;
- bool is_filetype_handled_securely_;
content::DownloadItem* download_;
const bool is_resumption_;
DownloadPrefs* download_prefs_;
DownloadTargetDeterminerDelegate* delegate_;
- CompletionCallback completion_callback_;
+ content::DownloadTargetCallback completion_callback_;
CancelableRequestConsumer history_consumer_;
base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_;
« no previous file with comments | « trunk/src/chrome/browser/download/download_stats.cc ('k') | trunk/src/chrome/browser/download/download_target_determiner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698