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

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

Issue 10263019: DownloadManagerDelegate::ShouldCompleteDownload(callback) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: complete_callback is the droids you're looking for. Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/callback.h" 10 #include "base/callback.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // Called when the download system wants to alert a WebContents that a 52 // Called when the download system wants to alert a WebContents that a
53 // download has started, but the TabConetnts has gone away. This lets an 53 // download has started, but the TabConetnts has gone away. This lets an
54 // delegate return an alternative WebContents. The delegate can return NULL. 54 // delegate return an alternative WebContents. The delegate can return NULL.
55 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); 55 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload();
56 56
57 // Tests if a file type should be opened automatically. 57 // Tests if a file type should be opened automatically.
58 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); 58 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path);
59 59
60 // Allows the delegate to override completion of the download. If this 60 // Allows the delegate to override completion of the download. If this
61 // function returns false, the download completion is delayed and the 61 // function returns false, the download completion is delayed and the delegate
62 // delegate is responsible for making sure that 62 // is responsible for making sure that |complete_callback| is run at some
63 // DownloadItem::MaybeCompleteDownload is called at some point in the 63 // point in the future. Note that at that point this function will be called
64 // future. Note that at that point this function will be called again, 64 // again, and is responsible for returning true when it really is ok for the
65 // and is responsible for returning true when it really is ok for the 65 // download to complete. If this method returns true, then |complete_callback|
66 // download to complete. 66 // will not be run.
Randy Smith (Not in Mondays) 2012/05/02 18:14:07 This doesn't spec the behavior if this function is
benjhayden 2012/05/03 19:21:14 PTAL Feel free to suggest alternate text. Also, I
Randy Smith (Not in Mondays) 2012/05/03 19:50:46 I was thinking about asking you to do that, but I
benjhayden 2012/05/04 17:02:54 That's how DM wants to use it now, but that's not
67 virtual bool ShouldCompleteDownload(DownloadItem* item); 67 virtual bool ShouldCompleteDownload(
68 DownloadItem* item,
69 const base::Closure& complete_callback);
68 70
69 // Allows the delegate to override opening the download. If this function 71 // Allows the delegate to override opening the download. If this function
70 // returns false, the delegate needs to call 72 // returns false, the delegate needs to call
71 // DownloadItem::DelayedDownloadOpened when it's done with the item, 73 // DownloadItem::DelayedDownloadOpened when it's done with the item,
72 // and is responsible for opening it. This function is called 74 // and is responsible for opening it. This function is called
73 // after the final rename, but before the download state is set to COMPLETED. 75 // after the final rename, but before the download state is set to COMPLETED.
74 virtual bool ShouldOpenDownload(DownloadItem* item); 76 virtual bool ShouldOpenDownload(DownloadItem* item);
75 77
76 // Returns true if we need to generate a binary hash for downloads. 78 // Returns true if we need to generate a binary hash for downloads.
77 virtual bool GenerateFileHash(); 79 virtual bool GenerateFileHash();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 virtual void ChooseSavePath(WebContents* web_contents, 117 virtual void ChooseSavePath(WebContents* web_contents,
116 const FilePath& suggested_path, 118 const FilePath& suggested_path,
117 const FilePath::StringType& default_extension, 119 const FilePath::StringType& default_extension,
118 bool can_save_as_complete, 120 bool can_save_as_complete,
119 SaveFilePathPickedCallback callback) {} 121 SaveFilePathPickedCallback callback) {}
120 }; 122 };
121 123
122 } // namespace content 124 } // namespace content
123 125
124 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 126 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/public/browser/download_item.h ('k') | content/public/browser/download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698