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: chrome/browser/download/download_status_updater.h

Issue 7618048: Move the core download files to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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) 2011 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_STATUS_UPDATER_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_
7
8 #include <set>
9
10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/weak_ptr.h"
13
14 class DownloadStatusUpdaterDelegate;
15
16 // Keeps track of download progress for the entire browser.
17 class DownloadStatusUpdater
18 : public base::SupportsWeakPtr<DownloadStatusUpdater> {
19 public:
20 DownloadStatusUpdater();
21 ~DownloadStatusUpdater();
22
23 void AddDelegate(DownloadStatusUpdaterDelegate* delegate);
24 void RemoveDelegate(DownloadStatusUpdaterDelegate* delegate);
25
26 // Updates the download status based on data from delegates.
27 void Update();
28
29 private:
30 FRIEND_TEST_ALL_PREFIXES(DownloadStatusUpdaterTest, Basic);
31 FRIEND_TEST_ALL_PREFIXES(DownloadStatusUpdaterTest, OneDelegate);
32 FRIEND_TEST_ALL_PREFIXES(DownloadStatusUpdaterTest, MultipleDelegates);
33
34 // If the progress is known (i.e. we know the final size of all downloads),
35 // returns true and puts a percentage (in range [0-1]) in |progress|.
36 bool GetProgress(float* progress);
37
38 // Returns the number of downloads that are in progress.
39 int64 GetInProgressDownloadCount();
40
41 typedef std::set<DownloadStatusUpdaterDelegate*> DelegateSet;
42 DelegateSet delegates_;
43
44 DISALLOW_COPY_AND_ASSIGN(DownloadStatusUpdater);
45 };
46
47 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698