| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 CallDownloadsList(const base::ListValue& downloads); |
| 100 virtual void CallDownloadUpdated(const base::ListValue& download); | 100 virtual void CallDownloadUpdated(const base::ListValue& download); |
| 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. |
| 107 virtual content::DownloadManager* GetMainNotifierManager(); |
| 108 |
| 106 private: | 109 private: |
| 107 // Shorthand for |observing_items_|, which tracks all items that this is | 110 // Shorthand for |observing_items_|, which tracks all items that this is |
| 108 // observing so that RemoveObserver will be called for all of them. | 111 // observing so that RemoveObserver will be called for all of them. |
| 109 typedef std::set<content::DownloadItem*> DownloadSet; | 112 typedef std::set<content::DownloadItem*> DownloadSet; |
| 110 | 113 |
| 111 // Sends the current list of downloads to the page. | 114 // Sends the current list of downloads to the page. |
| 112 void SendCurrentDownloads(); | 115 void SendCurrentDownloads(); |
| 113 | 116 |
| 114 // Displays a native prompt asking the user for confirmation after accepting | 117 // Displays a native prompt asking the user for confirmation after accepting |
| 115 // the dangerous download specified by |dangerous|. The function returns | 118 // the dangerous download specified by |dangerous|. The function returns |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 154 |
| 152 // Whether a call to SendCurrentDownloads() is currently scheduled. | 155 // Whether a call to SendCurrentDownloads() is currently scheduled. |
| 153 bool update_scheduled_; | 156 bool update_scheduled_; |
| 154 | 157 |
| 155 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; | 158 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; |
| 156 | 159 |
| 157 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); | 160 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); |
| 158 }; | 161 }; |
| 159 | 162 |
| 160 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ | 163 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ |
| OLD | NEW |