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

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

Issue 10974009: Rename HyperbolicDownloadItemNotifer -> AllDownloadItemNotifier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/download/all_download_item_notifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_HYPERBOLIC_DOWNLOAD_ITEM_NOTIFIER_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_ALL_DOWNLOAD_ITEM_NOTIFIER_H_
6 #define CHROME_BROWSER_DOWNLOAD_HYPERBOLIC_DOWNLOAD_ITEM_NOTIFIER_H_ 6 #define CHROME_BROWSER_DOWNLOAD_ALL_DOWNLOAD_ITEM_NOTIFIER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "content/public/browser/download_manager.h" 10 #include "content/public/browser/download_manager.h"
11 #include "content/public/browser/download_item.h" 11 #include "content/public/browser/download_item.h"
12 12
13 // HyperbolicDownloadItemNotifier observes ALL the DownloadItems on a given 13 // AllDownloadItemNotifier observes ALL the DownloadItems on a given
14 // DownloadManager. 14 // DownloadManager.
15 // Clients should use GetManager() instead of storing their own pointer to the 15 // Clients should use GetManager() instead of storing their own pointer to the
16 // manager so that they can be sensitive to managers that have gone down. 16 // manager so that they can be sensitive to managers that have gone down.
17 17
18 // Example Usage: 18 // Example Usage:
19 // class AndAHalf : public HyperbolicDownloadItemNotifier::Observer { 19 // class AndAHalf : public AllDownloadItemNotifier::Observer {
Randy Smith (Not in Mondays) 2012/09/24 16:03:48 HyperboleAndAHalf? (I.e. current name doesn't mak
benjhayden 2012/09/24 16:46:29 Done.
20 // public: 20 // public:
21 // AndAHalf(content::DownloadManager* original_manager, 21 // AndAHalf(content::DownloadManager* original_manager,
22 // content::DownloadManager* incognito_manager) 22 // content::DownloadManager* incognito_manager)
23 // : ALLOW_THIS_IN_INITIALIZATION_LIST(original_hyperbole_( 23 // : ALLOW_THIS_IN_INITIALIZATION_LIST(original_notifier_(
24 // original_manager, this)), 24 // original_manager, this)),
25 // ALLOW_THIS_IN_INITIALIZATION_LIST(incognito_hyperbole_( 25 // ALLOW_THIS_IN_INITIALIZATION_LIST(incognito_notifier_(
26 // incognito_manager, this)) { 26 // incognito_manager, this)) {
27 // } 27 // }
28 // 28 //
29 // virtual void OnDownloadUpdated( 29 // virtual void OnDownloadUpdated(
30 // content::DownloadManager* manager, content::DownloadItem* item) { ... } 30 // content::DownloadManager* manager, content::DownloadItem* item) { ... }
31 // 31 //
32 // private: 32 // private:
33 // HyperbolicDownloadItemNotifier original_hyperbole_; 33 // AllDownloadItemNotifier original_notifier_;
34 // HyperbolicDownloadItemNotifier incognito_hyperbole_; 34 // AllDownloadItemNotifier incognito_notifier_;
35 // }; 35 // };
36 36
37 class HyperbolicDownloadItemNotifier 37 class AllDownloadItemNotifier
38 : public content::DownloadManager::Observer, 38 : public content::DownloadManager::Observer,
39 public content::DownloadItem::Observer { 39 public content::DownloadItem::Observer {
40 public: 40 public:
41 // All of the methods take the DownloadManager so that subclasses can observe 41 // All of the methods take the DownloadManager so that subclasses can observe
42 // multiple managers at once and easily distinguish which manager a given item 42 // multiple managers at once and easily distinguish which manager a given item
43 // belongs to. 43 // belongs to.
44 class Observer { 44 class Observer {
45 public: 45 public:
46 Observer() {} 46 Observer() {}
47 virtual ~Observer() {} 47 virtual ~Observer() {}
48 48
49 virtual void OnDownloadCreated( 49 virtual void OnDownloadCreated(
50 content::DownloadManager* manager, content::DownloadItem* item) {} 50 content::DownloadManager* manager, content::DownloadItem* item) {}
51 virtual void OnDownloadUpdated( 51 virtual void OnDownloadUpdated(
52 content::DownloadManager* manager, content::DownloadItem* item) {} 52 content::DownloadManager* manager, content::DownloadItem* item) {}
53 virtual void OnDownloadOpened( 53 virtual void OnDownloadOpened(
54 content::DownloadManager* manager, content::DownloadItem* item) {} 54 content::DownloadManager* manager, content::DownloadItem* item) {}
55 virtual void OnDownloadRemoved( 55 virtual void OnDownloadRemoved(
56 content::DownloadManager* manager, content::DownloadItem* item) {} 56 content::DownloadManager* manager, content::DownloadItem* item) {}
57 57
58 private: 58 private:
59 DISALLOW_COPY_AND_ASSIGN(Observer); 59 DISALLOW_COPY_AND_ASSIGN(Observer);
60 }; 60 };
61 61
62 HyperbolicDownloadItemNotifier(content::DownloadManager* manager, 62 AllDownloadItemNotifier(content::DownloadManager* manager,
63 Observer* observer); 63 Observer* observer);
64 64
65 virtual ~HyperbolicDownloadItemNotifier(); 65 virtual ~AllDownloadItemNotifier();
66 66
67 // Returns NULL if the manager has gone down. 67 // Returns NULL if the manager has gone down.
68 content::DownloadManager* GetManager() const { return manager_; } 68 content::DownloadManager* GetManager() const { return manager_; }
69 69
70 private: 70 private:
71 // content::DownloadManager::Observer 71 // content::DownloadManager::Observer
72 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE; 72 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE;
73 virtual void OnDownloadCreated(content::DownloadManager* manager, 73 virtual void OnDownloadCreated(content::DownloadManager* manager,
74 content::DownloadItem* item) OVERRIDE; 74 content::DownloadItem* item) OVERRIDE;
75 75
76 // content::DownloadItem::Observer 76 // content::DownloadItem::Observer
77 virtual void OnDownloadUpdated(content::DownloadItem* item) OVERRIDE; 77 virtual void OnDownloadUpdated(content::DownloadItem* item) OVERRIDE;
78 virtual void OnDownloadOpened(content::DownloadItem* item) OVERRIDE; 78 virtual void OnDownloadOpened(content::DownloadItem* item) OVERRIDE;
79 virtual void OnDownloadRemoved(content::DownloadItem* item) OVERRIDE; 79 virtual void OnDownloadRemoved(content::DownloadItem* item) OVERRIDE;
80 virtual void OnDownloadDestroyed(content::DownloadItem* item) OVERRIDE; 80 virtual void OnDownloadDestroyed(content::DownloadItem* item) OVERRIDE;
81 81
82 content::DownloadManager* manager_; 82 content::DownloadManager* manager_;
83 HyperbolicDownloadItemNotifier::Observer* observer_; 83 AllDownloadItemNotifier::Observer* observer_;
84 std::set<content::DownloadItem*> observing_; 84 std::set<content::DownloadItem*> observing_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(HyperbolicDownloadItemNotifier); 86 DISALLOW_COPY_AND_ASSIGN(AllDownloadItemNotifier);
87 }; 87 };
88 88
89 #endif // CHROME_BROWSER_DOWNLOAD_HYPERBOLIC_DOWNLOAD_ITEM_NOTIFIER_H_ 89 #endif // CHROME_BROWSER_DOWNLOAD_ALL_DOWNLOAD_ITEM_NOTIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/all_download_item_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698