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

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

Issue 10263019: DownloadManagerDelegate::ShouldCompleteDownload(callback) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: cleanup 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_
7 #pragma once
8
9 #include "base/callback.h"
10 #include "content/public/browser/download_item.h"
11
12 // A subsystem may use a DownloadCompletionBlocker in conjunction with
13 // DownloadManagerDelegate::ShouldCompleteDownload() in order to block the
14 // completion of a DownloadItem.
Randy Smith (Not in Mondays) 2012/05/16 19:04:53 I'd be explicit about the semantics of this class,
benjhayden 2012/05/16 19:42:30 Done.
15 class DownloadCompletionBlocker : public content::DownloadItem::ExternalData {
16 public:
17 DownloadCompletionBlocker();
18 virtual ~DownloadCompletionBlocker();
19
20 bool is_complete() const { return is_complete_; }
21
22 void set_callback(const base::Closure& callback) {
23 if (!is_complete())
24 callback_ = callback;
25 }
26
27 // Mark this download item as complete with respect to this blocker. Other
28 // blockers may continue to block the item. Run |callback_|.
29 // Subclasses must chain if they override this method.
Randy Smith (Not in Mondays) 2012/05/16 19:04:53 nit, suggestion: My guess as to what you meant by
benjhayden 2012/05/16 19:42:30 Done.
30 virtual void CompleteDownload();
31
32 private:
33 bool is_complete_;
34 base::Closure callback_;
35
36 DISALLOW_COPY_AND_ASSIGN(DownloadCompletionBlocker);
37 };
38
39 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698