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

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

Issue 977473002: downloads: break downloads.js into more classes/files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig@ review Created 5 years, 9 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_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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // Callback for the "openDownloadsFolder" message - opens the downloads 90 // Callback for the "openDownloadsFolder" message - opens the downloads
91 // folder. 91 // folder.
92 void HandleOpenDownloadsFolder(const base::ListValue* args); 92 void HandleOpenDownloadsFolder(const base::ListValue* args);
93 93
94 protected: 94 protected:
95 // These methods are for mocking so that most of this class does not actually 95 // These methods are for mocking so that most of this class does not actually
96 // depend on WebUI. The other methods that depend on WebUI are 96 // depend on WebUI. The other methods that depend on WebUI are
97 // RegisterMessages() and HandleDrag(). 97 // RegisterMessages() and HandleDrag().
98 virtual content::WebContents* GetWebUIWebContents(); 98 virtual content::WebContents* GetWebUIWebContents();
99 virtual void CallDownloadsList(const base::ListValue& downloads); 99 virtual void CallUpdateAll(const base::ListValue& list);
100 virtual void CallDownloadUpdated(const base::ListValue& download); 100 virtual void CallUpdateItem(const base::DictionaryValue& item);
101 101
102 // Schedules a call to SendCurrentDownloads() in the next message loop 102 // Schedules a call to SendCurrentDownloads() in the next message loop
103 // iteration. Protected rather than private for use in tests. 103 // iteration. Protected rather than private for use in tests.
104 void ScheduleSendCurrentDownloads(); 104 void ScheduleSendCurrentDownloads();
105 105
106 // Protected for testing. 106 // Protected for testing.
107 virtual content::DownloadManager* GetMainNotifierManager(); 107 virtual content::DownloadManager* GetMainNotifierManager();
108 108
109 // Actually remove downloads with an ID in |removals_|. This cannot be undone. 109 // Actually remove downloads with an ID in |removals_|. This cannot be undone.
110 void FinalizeRemovals(); 110 void FinalizeRemovals();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // If |main_notifier_| observes an incognito profile, then this observes the 151 // If |main_notifier_| observes an incognito profile, then this observes the
152 // DownloadManager for the original profile; otherwise, this is NULL. 152 // DownloadManager for the original profile; otherwise, this is NULL.
153 scoped_ptr<AllDownloadItemNotifier> original_notifier_; 153 scoped_ptr<AllDownloadItemNotifier> original_notifier_;
154 154
155 // IDs of downloads to remove when this handler gets deleted. 155 // IDs of downloads to remove when this handler gets deleted.
156 std::vector<std::set<uint32>> removals_; 156 std::vector<std::set<uint32>> removals_;
157 157
158 // Whether a call to SendCurrentDownloads() is currently scheduled. 158 // Whether a call to SendCurrentDownloads() is currently scheduled.
159 bool update_scheduled_; 159 bool update_scheduled_;
160 160
161 // IDs of new downloads that the page doesn't know about yet.
162 std::set<uint32> new_downloads_;
163
161 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; 164 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_;
162 165
163 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); 166 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler);
164 }; 167 };
165 168
166 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ 169 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/downloads/manager.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