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

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

Issue 665253002: Standardize usage of virtual/override/final in chrome/browser/download/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/supports_user_data.h" 9 #include "base/supports_user_data.h"
10 #include "content/public/browser/download_item.h" 10 #include "content/public/browser/download_item.h"
11 11
12 // A subsystem may use a DownloadCompletionBlocker in conjunction with 12 // A subsystem may use a DownloadCompletionBlocker in conjunction with
13 // DownloadManagerDelegate::ShouldCompleteDownload() in order to block the 13 // DownloadManagerDelegate::ShouldCompleteDownload() in order to block the
14 // completion of a DownloadItem. CompleteDownload() will run the most recent 14 // completion of a DownloadItem. CompleteDownload() will run the most recent
15 // callback set. 15 // callback set.
16 class DownloadCompletionBlocker : public base::SupportsUserData::Data { 16 class DownloadCompletionBlocker : public base::SupportsUserData::Data {
17 public: 17 public:
18 DownloadCompletionBlocker(); 18 DownloadCompletionBlocker();
19 virtual ~DownloadCompletionBlocker(); 19 ~DownloadCompletionBlocker() override;
20 20
21 bool is_complete() const { return is_complete_; } 21 bool is_complete() const { return is_complete_; }
22 22
23 void set_callback(const base::Closure& callback) { 23 void set_callback(const base::Closure& callback) {
24 if (!is_complete()) 24 if (!is_complete())
25 callback_ = callback; 25 callback_ = callback;
26 } 26 }
27 27
28 // Mark this download item as complete with respect to this blocker. (Other 28 // Mark this download item as complete with respect to this blocker. (Other
29 // blockers may continue to block the item.) Run |callback_|. This method may 29 // blockers may continue to block the item.) Run |callback_|. This method may
30 // only be called once, so |callback_| will only be called once. Subclasses 30 // only be called once, so |callback_| will only be called once. Subclasses
31 // must call the base implementation if they override this method. 31 // must call the base implementation if they override this method.
32 virtual void CompleteDownload(); 32 virtual void CompleteDownload();
33 33
34 private: 34 private:
35 bool is_complete_; 35 bool is_complete_;
36 base::Closure callback_; 36 base::Closure callback_;
37 37
38 DISALLOW_COPY_AND_ASSIGN(DownloadCompletionBlocker); 38 DISALLOW_COPY_AND_ASSIGN(DownloadCompletionBlocker);
39 }; 39 };
40 40
41 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_ 41 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_COMPLETION_BLOCKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_danger_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698