| 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 12 matching lines...) Expand all Loading... |
| 23 namespace content { | 23 namespace content { |
| 24 class WebContents; | 24 class WebContents; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // The handler for Javascript messages related to the "downloads" view, | 27 // The handler for Javascript messages related to the "downloads" view, |
| 28 // also observes changes to the download manager. | 28 // also observes changes to the download manager. |
| 29 class DownloadsDOMHandler : public content::WebUIMessageHandler, | 29 class DownloadsDOMHandler : public content::WebUIMessageHandler, |
| 30 public AllDownloadItemNotifier::Observer { | 30 public AllDownloadItemNotifier::Observer { |
| 31 public: | 31 public: |
| 32 explicit DownloadsDOMHandler(content::DownloadManager* dlm); | 32 explicit DownloadsDOMHandler(content::DownloadManager* dlm); |
| 33 virtual ~DownloadsDOMHandler(); | 33 ~DownloadsDOMHandler() override; |
| 34 | 34 |
| 35 void Init(); | 35 void Init(); |
| 36 | 36 |
| 37 // WebUIMessageHandler implementation. | 37 // WebUIMessageHandler implementation. |
| 38 virtual void RegisterMessages() override; | 38 void RegisterMessages() override; |
| 39 | 39 |
| 40 // AllDownloadItemNotifier::Observer interface | 40 // AllDownloadItemNotifier::Observer interface |
| 41 virtual void OnDownloadCreated( | 41 void OnDownloadCreated(content::DownloadManager* manager, |
| 42 content::DownloadManager* manager, | 42 content::DownloadItem* download_item) override; |
| 43 content::DownloadItem* download_item) override; | 43 void OnDownloadUpdated(content::DownloadManager* manager, |
| 44 virtual void OnDownloadUpdated( | 44 content::DownloadItem* download_item) override; |
| 45 content::DownloadManager* manager, | 45 void OnDownloadRemoved(content::DownloadManager* manager, |
| 46 content::DownloadItem* download_item) override; | 46 content::DownloadItem* download_item) override; |
| 47 virtual void OnDownloadRemoved( | |
| 48 content::DownloadManager* manager, | |
| 49 content::DownloadItem* download_item) override; | |
| 50 | 47 |
| 51 // Callback for the "onPageLoaded" message. | 48 // Callback for the "onPageLoaded" message. |
| 52 void OnPageLoaded(const base::ListValue* args); | 49 void OnPageLoaded(const base::ListValue* args); |
| 53 | 50 |
| 54 // Callback for the "getDownloads" message. | 51 // Callback for the "getDownloads" message. |
| 55 void HandleGetDownloads(const base::ListValue* args); | 52 void HandleGetDownloads(const base::ListValue* args); |
| 56 | 53 |
| 57 // Callback for the "openFile" message - opens the file in the shell. | 54 // Callback for the "openFile" message - opens the file in the shell. |
| 58 void HandleOpenFile(const base::ListValue* args); | 55 void HandleOpenFile(const base::ListValue* args); |
| 59 | 56 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 139 |
| 143 // Whether a call to SendCurrentDownloads() is currently scheduled. | 140 // Whether a call to SendCurrentDownloads() is currently scheduled. |
| 144 bool update_scheduled_; | 141 bool update_scheduled_; |
| 145 | 142 |
| 146 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; | 143 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; |
| 147 | 144 |
| 148 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); | 145 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); |
| 149 }; | 146 }; |
| 150 | 147 |
| 151 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ | 148 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ |
| OLD | NEW |