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

Side by Side Diff: chrome/browser/download/download_history.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_HISTORY_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // restored from history. 73 // restored from history.
74 static bool IsPersisted(const content::DownloadItem* item); 74 static bool IsPersisted(const content::DownloadItem* item);
75 75
76 // Neither |manager| nor |history| may be NULL. 76 // Neither |manager| nor |history| may be NULL.
77 // DownloadService creates DownloadHistory some time after DownloadManager is 77 // DownloadService creates DownloadHistory some time after DownloadManager is
78 // created and destroys DownloadHistory as DownloadManager is shutting down. 78 // created and destroys DownloadHistory as DownloadManager is shutting down.
79 DownloadHistory( 79 DownloadHistory(
80 content::DownloadManager* manager, 80 content::DownloadManager* manager,
81 scoped_ptr<HistoryAdapter> history); 81 scoped_ptr<HistoryAdapter> history);
82 82
83 virtual ~DownloadHistory(); 83 ~DownloadHistory() override;
84 84
85 void AddObserver(Observer* observer); 85 void AddObserver(Observer* observer);
86 void RemoveObserver(Observer* observer); 86 void RemoveObserver(Observer* observer);
87 87
88 // Returns true if the download was restored from history. Safe to call from 88 // Returns true if the download was restored from history. Safe to call from
89 // within a DownloadManager::Observer::OnDownloadCreated handler and can be 89 // within a DownloadManager::Observer::OnDownloadCreated handler and can be
90 // used to distinguish between downloads that were created due to new requests 90 // used to distinguish between downloads that were created due to new requests
91 // vs. downloads that were created due to being restored from history. Note 91 // vs. downloads that were created due to being restored from history. Note
92 // that the return value is only reliable for downloads that were restored by 92 // that the return value is only reliable for downloads that were restored by
93 // this specific DownloadHistory instance. 93 // this specific DownloadHistory instance.
94 bool WasRestoredFromHistory(const content::DownloadItem* item) const; 94 bool WasRestoredFromHistory(const content::DownloadItem* item) const;
95 95
96 private: 96 private:
97 typedef std::set<content::DownloadItem*> ItemSet; 97 typedef std::set<content::DownloadItem*> ItemSet;
98 98
99 // Callback from |history_| containing all entries in the downloads database 99 // Callback from |history_| containing all entries in the downloads database
100 // table. 100 // table.
101 void QueryCallback( 101 void QueryCallback(
102 scoped_ptr<std::vector<history::DownloadRow> > infos); 102 scoped_ptr<std::vector<history::DownloadRow> > infos);
103 103
104 // May add |item| to |history_|. 104 // May add |item| to |history_|.
105 void MaybeAddToHistory(content::DownloadItem* item); 105 void MaybeAddToHistory(content::DownloadItem* item);
106 106
107 // Callback from |history_| when an item was successfully inserted into the 107 // Callback from |history_| when an item was successfully inserted into the
108 // database. 108 // database.
109 void ItemAdded(uint32 id, bool success); 109 void ItemAdded(uint32 id, bool success);
110 110
111 // AllDownloadItemNotifier::Observer 111 // AllDownloadItemNotifier::Observer
112 virtual void OnDownloadCreated( 112 void OnDownloadCreated(content::DownloadManager* manager,
113 content::DownloadManager* manager, content::DownloadItem* item) override; 113 content::DownloadItem* item) override;
114 virtual void OnDownloadUpdated( 114 void OnDownloadUpdated(content::DownloadManager* manager,
115 content::DownloadManager* manager, content::DownloadItem* item) override; 115 content::DownloadItem* item) override;
116 virtual void OnDownloadOpened( 116 void OnDownloadOpened(content::DownloadManager* manager,
117 content::DownloadManager* manager, content::DownloadItem* item) override; 117 content::DownloadItem* item) override;
118 virtual void OnDownloadRemoved( 118 void OnDownloadRemoved(content::DownloadManager* manager,
119 content::DownloadManager* manager, content::DownloadItem* item) override; 119 content::DownloadItem* item) override;
120 120
121 // Schedule a record to be removed from |history_| the next time 121 // Schedule a record to be removed from |history_| the next time
122 // RemoveDownloadsBatch() runs. Schedule RemoveDownloadsBatch() to be run soon 122 // RemoveDownloadsBatch() runs. Schedule RemoveDownloadsBatch() to be run soon
123 // if it isn't already scheduled. 123 // if it isn't already scheduled.
124 void ScheduleRemoveDownload(uint32 download_id); 124 void ScheduleRemoveDownload(uint32 download_id);
125 125
126 // Removes all |removing_ids_| from |history_|. 126 // Removes all |removing_ids_| from |history_|.
127 void RemoveDownloadsBatch(); 127 void RemoveDownloadsBatch();
128 128
129 AllDownloadItemNotifier notifier_; 129 AllDownloadItemNotifier notifier_;
(...skipping 19 matching lines...) Expand all
149 int64 history_size_; 149 int64 history_size_;
150 150
151 ObserverList<Observer> observers_; 151 ObserverList<Observer> observers_;
152 152
153 base::WeakPtrFactory<DownloadHistory> weak_ptr_factory_; 153 base::WeakPtrFactory<DownloadHistory> weak_ptr_factory_;
154 154
155 DISALLOW_COPY_AND_ASSIGN(DownloadHistory); 155 DISALLOW_COPY_AND_ASSIGN(DownloadHistory);
156 }; 156 };
157 157
158 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_ 158 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_HISTORY_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_file_picker.h ('k') | chrome/browser/download/download_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698