| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/browser/webui/web_ui.h" | |
| 13 #include "content/public/browser/download_item.h" | 12 #include "content/public/browser/download_item.h" |
| 14 #include "content/public/browser/download_manager.h" | 13 #include "content/public/browser/download_manager.h" |
| 14 #include "content/public/browser/web_ui_message_handler.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class ListValue; | 17 class ListValue; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // The handler for Javascript messages related to the "downloads" view, | 20 // The handler for Javascript messages related to the "downloads" view, |
| 21 // also observes changes to the download manager. | 21 // also observes changes to the download manager. |
| 22 class DownloadsDOMHandler : public WebUIMessageHandler, | 22 class DownloadsDOMHandler : public content::WebUIMessageHandler, |
| 23 public content::DownloadManager::Observer, | 23 public content::DownloadManager::Observer, |
| 24 public content::DownloadItem::Observer { | 24 public content::DownloadItem::Observer { |
| 25 public: | 25 public: |
| 26 explicit DownloadsDOMHandler(content::DownloadManager* dlm); | 26 explicit DownloadsDOMHandler(content::DownloadManager* dlm); |
| 27 virtual ~DownloadsDOMHandler(); | 27 virtual ~DownloadsDOMHandler(); |
| 28 | 28 |
| 29 void Init(); | 29 void Init(); |
| 30 | 30 |
| 31 // WebUIMessageHandler implementation. | 31 // WebUIMessageHandler implementation. |
| 32 virtual void RegisterMessages() OVERRIDE; | 32 virtual void RegisterMessages() OVERRIDE; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Note that when a download item is removed, the entry in the vector becomes | 107 // Note that when a download item is removed, the entry in the vector becomes |
| 108 // null. This should only be a transient state, as a ModelChanged() | 108 // null. This should only be a transient state, as a ModelChanged() |
| 109 // notification should follow close on the heels of such a change. | 109 // notification should follow close on the heels of such a change. |
| 110 typedef std::vector<content::DownloadItem*> OrderedDownloads; | 110 typedef std::vector<content::DownloadItem*> OrderedDownloads; |
| 111 OrderedDownloads download_items_; | 111 OrderedDownloads download_items_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); | 113 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ | 116 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ |
| OLD | NEW |