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

Side by Side Diff: content/public/browser/download_manager_delegate.h

Issue 8414007: Rearrange Should*Download delegate calls to be more useful and intuitive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to TOT. 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_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 FilePath* intermediate_path) = 0; 44 FilePath* intermediate_path) = 0;
45 45
46 // Called when the download system wants to alert a TabContents that a 46 // Called when the download system wants to alert a TabContents that a
47 // download has started, but the TabConetnts has gone away. This lets an 47 // download has started, but the TabConetnts has gone away. This lets an
48 // delegate return an alternative TabContents. The delegate can return NULL. 48 // delegate return an alternative TabContents. The delegate can return NULL.
49 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() = 0; 49 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() = 0;
50 50
51 // Tests if a file type should be opened automatically. 51 // Tests if a file type should be opened automatically.
52 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) = 0; 52 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) = 0;
53 53
54 // Allows the delegate to override the opening of a download. If it returns 54 // Allows the delegate to override completion of the download. If this
55 // true then it's reponsible for opening the item. 55 // function returns false, the download completion is delayed and the
56 // delegate is responsible for making sure that
57 // DownloadManager::MaybeCompleteDownload is called at some point in the
58 // future. Note that at that point this function will be called again,
59 // and is responsible for returning true when it really is ok for the
60 // download to complete.
61 virtual bool ShouldCompleteDownload(DownloadItem* item) = 0;
62
63 // Allows the delegate to override opening the download. If this function
64 // returns false, the delegate needs to call
65 // DownloadItem::DelayedDownloadOpened when it's done with the item,
66 // and is responsible for opening it. This function is called
67 // after the final rename, but before the download state is set to COMPLETED.
56 virtual bool ShouldOpenDownload(DownloadItem* item) = 0; 68 virtual bool ShouldOpenDownload(DownloadItem* item) = 0;
57 69
58 // Allows the delegate to override completing the download. The delegate needs
59 // to call DownloadItem::CompleteDelayedDownload when it's done with the item,
60 // and is responsible for opening it.
61 virtual bool ShouldCompleteDownload(DownloadItem* item) = 0;
62
63 // Returns true if we need to generate a binary hash for downloads. 70 // Returns true if we need to generate a binary hash for downloads.
64 virtual bool GenerateFileHash() = 0; 71 virtual bool GenerateFileHash() = 0;
65 72
66 // Informs the delegate that given download has finishd downloading, and gives 73 // Informs the delegate that given download has finishd downloading, and gives
67 // it the hash (if it chose to compute it from GenerateFileHash()). 74 // it the hash (if it chose to compute it from GenerateFileHash()).
68 virtual void OnResponseCompleted(DownloadItem* item, 75 virtual void OnResponseCompleted(DownloadItem* item,
69 const std::string& hash) = 0; 76 const std::string& hash) = 0;
70 77
71 // Notifies the delegate that a new download item is created. The 78 // Notifies the delegate that a new download item is created. The
72 // DownloadManager waits for the delegate to add information about this 79 // DownloadManager waits for the delegate to add information about this
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 118
112 protected: 119 protected:
113 DownloadManagerDelegate() {} 120 DownloadManagerDelegate() {}
114 121
115 DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegate); 122 DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegate);
116 }; 123 };
117 124
118 } // namespace content 125 } // namespace content
119 126
120 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 127 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/browser/download/mock_download_manager_delegate.cc ('k') | content/shell/shell_download_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698