| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 81   // Callback for the "cancel" message - cancels the download. | 81   // Callback for the "cancel" message - cancels the download. | 
| 82   void HandleCancel(const base::ListValue* args); | 82   void HandleCancel(const base::ListValue* args); | 
| 83 | 83 | 
| 84   // Callback for the "clearAll" message - clears all the downloads. | 84   // Callback for the "clearAll" message - clears all the downloads. | 
| 85   void HandleClearAll(const base::ListValue* args); | 85   void HandleClearAll(const base::ListValue* args); | 
| 86 | 86 | 
| 87   // Callback for the "openDownloadsFolder" message - opens the downloads | 87   // Callback for the "openDownloadsFolder" message - opens the downloads | 
| 88   // folder. | 88   // folder. | 
| 89   void HandleOpenDownloadsFolder(const base::ListValue* args); | 89   void HandleOpenDownloadsFolder(const base::ListValue* args); | 
| 90 | 90 | 
|  | 91   // Callback for the "undoRemove" message. Undoes any previous removal. | 
|  | 92   void HandleUndoRemove(const base::ListValue* args); | 
|  | 93 | 
| 91  protected: | 94  protected: | 
| 92   // 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 | 
| 93   // depend on WebUI. The other methods that depend on WebUI are | 96   // depend on WebUI. The other methods that depend on WebUI are | 
| 94   // RegisterMessages() and HandleDrag(). | 97   // RegisterMessages() and HandleDrag(). | 
| 95   virtual content::WebContents* GetWebUIWebContents(); | 98   virtual content::WebContents* GetWebUIWebContents(); | 
| 96   virtual void CallDownloadsList(const base::ListValue& downloads); | 99   virtual void CallDownloadsList(const base::ListValue& downloads); | 
| 97   virtual void CallDownloadUpdated(const base::ListValue& download); | 100   virtual void CallDownloadUpdated(const base::ListValue& download); | 
| 98 | 101 | 
| 99   // Schedules a call to SendCurrentDownloads() in the next message loop | 102   // Schedules a call to SendCurrentDownloads() in the next message loop | 
| 100   // iteration. Protected rather than private for use in tests. | 103   // iteration. Protected rather than private for use in tests. | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 117   void ShowDangerPrompt(content::DownloadItem* dangerous); | 120   void ShowDangerPrompt(content::DownloadItem* dangerous); | 
| 118 | 121 | 
| 119   // Conveys danger acceptance from the DownloadDangerPrompt to the | 122   // Conveys danger acceptance from the DownloadDangerPrompt to the | 
| 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 | 
|  | 130   // Returns the download with ID of |download_id|. | 
|  | 131   content::DownloadItem* GetDownloadById(uint32 download_id); | 
|  | 132 | 
| 127   // Returns the download that is referred to in a given value. | 133   // Returns the download that is referred to in a given value. | 
| 128   content::DownloadItem* GetDownloadByValue(const base::ListValue* args); | 134   content::DownloadItem* GetDownloadByValue(const base::ListValue* args); | 
| 129 | 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 | 
| 140   // Whether a call to SendCurrentDownloads() is currently scheduled. | 146   // Whether a call to SendCurrentDownloads() is currently scheduled. | 
| 141   bool update_scheduled_; | 147   bool update_scheduled_; | 
| 142 | 148 | 
|  | 149   // IDs of downloads that have been removed from this page. These IDs are | 
|  | 150   // purged and the downloads are actually removed on destruction. | 
|  | 151   std::vector<uint32> removed_ids_; | 
|  | 152 | 
| 143   base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; | 153   base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; | 
| 144 | 154 | 
| 145   DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); | 155   DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); | 
| 146 }; | 156 }; | 
| 147 | 157 | 
| 148 #endif  // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ | 158 #endif  // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ | 
| OLD | NEW | 
|---|