| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/download/all_download_item_notifier.h" | 13 #include "chrome/browser/download/all_download_item_notifier.h" |
| 14 #include "chrome/browser/download/download_danger_prompt.h" |
| 14 #include "content/public/browser/download_item.h" | 15 #include "content/public/browser/download_item.h" |
| 15 #include "content/public/browser/download_manager.h" | 16 #include "content/public/browser/download_manager.h" |
| 16 #include "content/public/browser/web_ui_message_handler.h" | 17 #include "content/public/browser/web_ui_message_handler.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class ListValue; | 20 class ListValue; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 class WebContents; | 24 class WebContents; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // Displays a native prompt asking the user for confirmation after accepting | 114 // Displays a native prompt asking the user for confirmation after accepting |
| 114 // the dangerous download specified by |dangerous|. The function returns | 115 // the dangerous download specified by |dangerous|. The function returns |
| 115 // immediately, and will invoke DangerPromptAccepted() asynchronously if the | 116 // immediately, and will invoke DangerPromptAccepted() asynchronously if the |
| 116 // user accepts the dangerous download. The native prompt will observe | 117 // user accepts the dangerous download. The native prompt will observe |
| 117 // |dangerous| until either the dialog is dismissed or |dangerous| is no | 118 // |dangerous| until either the dialog is dismissed or |dangerous| is no |
| 118 // longer an in-progress dangerous download. | 119 // longer an in-progress dangerous download. |
| 119 void ShowDangerPrompt(content::DownloadItem* dangerous); | 120 void ShowDangerPrompt(content::DownloadItem* dangerous); |
| 120 | 121 |
| 121 // Conveys danger acceptance from the DownloadDangerPrompt to the | 122 // Conveys danger acceptance from the DownloadDangerPrompt to the |
| 122 // DownloadItem. | 123 // DownloadItem. |
| 123 void DangerPromptAccepted(int download_id); | 124 void DangerPromptDone(int download_id, DownloadDangerPrompt::Action action); |
| 124 | 125 |
| 125 // 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) |
| 126 // to be deleted. | 127 // to be deleted. |
| 127 bool IsDeletingHistoryAllowed(); | 128 bool IsDeletingHistoryAllowed(); |
| 128 | 129 |
| 129 // Returns the download that is referred to in a given value. | 130 // Returns the download that is referred to in a given value. |
| 130 content::DownloadItem* GetDownloadByValue(const base::ListValue* args); | 131 content::DownloadItem* GetDownloadByValue(const base::ListValue* args); |
| 131 | 132 |
| 132 // Current search text. | 133 // Current search text. |
| 133 string16 search_text_; | 134 string16 search_text_; |
| 134 | 135 |
| 135 // Notifies OnDownload*() and provides safe access to the DownloadManager. | 136 // Notifies OnDownload*() and provides safe access to the DownloadManager. |
| 136 AllDownloadItemNotifier main_notifier_; | 137 AllDownloadItemNotifier main_notifier_; |
| 137 | 138 |
| 138 // If |main_notifier_| observes an incognito profile, then this observes the | 139 // If |main_notifier_| observes an incognito profile, then this observes the |
| 139 // DownloadManager for the original profile; otherwise, this is NULL. | 140 // DownloadManager for the original profile; otherwise, this is NULL. |
| 140 scoped_ptr<AllDownloadItemNotifier> original_notifier_; | 141 scoped_ptr<AllDownloadItemNotifier> original_notifier_; |
| 141 | 142 |
| 142 // Whether a call to SendCurrentDownloads() is currently scheduled. | 143 // Whether a call to SendCurrentDownloads() is currently scheduled. |
| 143 bool update_scheduled_; | 144 bool update_scheduled_; |
| 144 | 145 |
| 145 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; | 146 base::WeakPtrFactory<DownloadsDOMHandler> weak_ptr_factory_; |
| 146 | 147 |
| 147 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); | 148 DISALLOW_COPY_AND_ASSIGN(DownloadsDOMHandler); |
| 148 }; | 149 }; |
| 149 | 150 |
| 150 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ | 151 #endif // CHROME_BROWSER_UI_WEBUI_DOWNLOADS_DOM_HANDLER_H_ |
| OLD | NEW |