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

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: " 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. It is safe to call this method any number of times both
67 virtual bool ShouldCompleteDownload(DownloadItem* item); 67 // before and after |complete_callback| runs; this method will return false
68 // until the download should complete, then it will run the last
69 // |complete_callback| passed to it and begin returning true when called.
Randy Smith (Not in Mondays) 2012/05/03 19:50:47 I'd phrase it somewhat differently. I think what
benjhayden 2012/05/04 17:02:54 Please just give the exact text that you want here
70 virtual bool ShouldCompleteDownload(
71 DownloadItem* item,
72 const base::Closure& complete_callback);
68 73
69 // Allows the delegate to override opening the download. If this function 74 // Allows the delegate to override opening the download. If this function
70 // returns false, the delegate needs to call 75 // returns false, the delegate needs to call
71 // DownloadItem::DelayedDownloadOpened when it's done with the item, 76 // DownloadItem::DelayedDownloadOpened when it's done with the item,
72 // and is responsible for opening it. This function is called 77 // and is responsible for opening it. This function is called
73 // after the final rename, but before the download state is set to COMPLETED. 78 // after the final rename, but before the download state is set to COMPLETED.
74 virtual bool ShouldOpenDownload(DownloadItem* item); 79 virtual bool ShouldOpenDownload(DownloadItem* item);
75 80
76 // Returns true if we need to generate a binary hash for downloads. 81 // Returns true if we need to generate a binary hash for downloads.
77 virtual bool GenerateFileHash(); 82 virtual bool GenerateFileHash();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 virtual void ChooseSavePath(WebContents* web_contents, 120 virtual void ChooseSavePath(WebContents* web_contents,
116 const FilePath& suggested_path, 121 const FilePath& suggested_path,
117 const FilePath::StringType& default_extension, 122 const FilePath::StringType& default_extension,
118 bool can_save_as_complete, 123 bool can_save_as_complete,
119 SaveFilePathPickedCallback callback) {} 124 SaveFilePathPickedCallback callback) {}
120 }; 125 };
121 126
122 } // namespace content 127 } // namespace content
123 128
124 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 129 #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