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

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler.h

Issue 722953002: downloads: add the ability to undo download removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 6 years 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_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Callback for the "pause" message - pauses the file download. 71 // Callback for the "pause" message - pauses the file download.
72 void HandlePause(const base::ListValue* args); 72 void HandlePause(const base::ListValue* args);
73 73
74 // Callback for the "resume" message - resumes the file download. 74 // Callback for the "resume" message - resumes the file download.
75 void HandleResume(const base::ListValue* args); 75 void HandleResume(const base::ListValue* args);
76 76
77 // Callback for the "remove" message - removes the file download from shelf 77 // Callback for the "remove" message - removes the file download from shelf
78 // and list. 78 // and list.
79 void HandleRemove(const base::ListValue* args); 79 void HandleRemove(const base::ListValue* args);
80 80
81 // Callback for the "undo" message. Currently only undoes removals.
82 void HandleUndo(const base::ListValue* args);
83
81 // Callback for the "cancel" message - cancels the download. 84 // Callback for the "cancel" message - cancels the download.
82 void HandleCancel(const base::ListValue* args); 85 void HandleCancel(const base::ListValue* args);
83 86
84 // Callback for the "clearAll" message - clears all the downloads. 87 // Callback for the "clearAll" message - clears all the downloads.
85 void HandleClearAll(const base::ListValue* args); 88 void HandleClearAll(const base::ListValue* args);
86 89
87 // Callback for the "openDownloadsFolder" message - opens the downloads 90 // Callback for the "openDownloadsFolder" message - opens the downloads
88 // folder. 91 // folder.
89 void HandleOpenDownloadsFolder(const base::ListValue* args); 92 void HandleOpenDownloadsFolder(const base::ListValue* args);
90 93
(...skipping 29 matching lines...) Expand all
120 // DownloadItem. 123 // DownloadItem.
121 void DangerPromptDone(int download_id, DownloadDangerPrompt::Action action); 124 void DangerPromptDone(int download_id, DownloadDangerPrompt::Action action);
122 125
123 // Returns true if the records of any downloaded items are allowed (and able) 126 // Returns true if the records of any downloaded items are allowed (and able)
124 // to be deleted. 127 // to be deleted.
125 bool IsDeletingHistoryAllowed(); 128 bool IsDeletingHistoryAllowed();
126 129
127 // Returns the download that is referred to in a given value. 130 // Returns the download that is referred to in a given value.
128 content::DownloadItem* GetDownloadByValue(const base::ListValue* args); 131 content::DownloadItem* GetDownloadByValue(const base::ListValue* args);
129 132
133 // Returns the download with |id| or NULL if it doesn't exist.
134 content::DownloadItem* GetDownloadById(uint32 id);
135
130 // Current search terms. 136 // Current search terms.
131 scoped_ptr<base::ListValue> search_terms_; 137 scoped_ptr<base::ListValue> search_terms_;
132 138
133 // Notifies OnDownload*() and provides safe access to the DownloadManager. 139 // Notifies OnDownload*() and provides safe access to the DownloadManager.
134 AllDownloadItemNotifier main_notifier_; 140 AllDownloadItemNotifier main_notifier_;
135 141
136 // If |main_notifier_| observes an incognito profile, then this observes the 142 // If |main_notifier_| observes an incognito profile, then this observes the
137 // DownloadManager for the original profile; otherwise, this is NULL. 143 // DownloadManager for the original profile; otherwise, this is NULL.
138 scoped_ptr<AllDownloadItemNotifier> original_notifier_; 144 scoped_ptr<AllDownloadItemNotifier> original_notifier_;
139 145
146 // IDs of downloads to remove when this handler gets deleted.
147 std::vector<uint32> removed_ids_;
148
140 // Whether a call to SendCurrentDownloads() is currently scheduled. 149 // Whether a call to SendCurrentDownloads() is currently scheduled.
141 bool update_scheduled_; 150 bool update_scheduled_;
142 151
143 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; 152 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_;
144 153
145 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); 154 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler);
146 }; 155 };
147 156
148 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ 157 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/downloads/downloads.js ('k') | chrome/browser/ui/webui/downloads_dom_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698