| 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 #include "chrome/browser/ui/webui/active_downloads_ui.h" | 5 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ActiveDownloadsUIHTMLSource::StartDataRequest(const std::string& path, | 147 void ActiveDownloadsUIHTMLSource::StartDataRequest(const std::string& path, |
| 148 bool is_incognito, | 148 bool is_incognito, |
| 149 int request_id) { | 149 int request_id) { |
| 150 DictionaryValue localized_strings; | 150 DictionaryValue localized_strings; |
| 151 localized_strings.SetString("allowdownload", | 151 localized_strings.SetString("allowdownload", |
| 152 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_DOWNLOAD)); | 152 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_DOWNLOAD)); |
| 153 localized_strings.SetString("cancel", | 153 localized_strings.SetString("cancel", |
| 154 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_CANCEL)); | 154 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_CANCEL)); |
| 155 localized_strings.SetString("confirmcancel", |
| 156 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_CANCEL)); |
| 157 localized_strings.SetString("confirmyes", |
| 158 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_YES)); |
| 155 localized_strings.SetString("open", | 159 localized_strings.SetString("open", |
| 156 l10n_util::GetStringUTF16(IDS_FILEBROWSER_OPEN)); | 160 l10n_util::GetStringUTF16(IDS_FILEBROWSER_OPEN)); |
| 157 localized_strings.SetString("pause", | 161 localized_strings.SetString("pause", |
| 158 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_PAUSE)); | 162 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_PAUSE)); |
| 159 localized_strings.SetString("resume", | 163 localized_strings.SetString("resume", |
| 160 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_RESUME)); | 164 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_RESUME)); |
| 161 localized_strings.SetString("showalldownloads", | 165 localized_strings.SetString("showalldownloads", |
| 162 l10n_util::GetStringUTF16(IDS_FILEBROWSER_SHOW_ALL_DOWNLOADS)); | 166 l10n_util::GetStringUTF16(IDS_FILEBROWSER_SHOW_ALL_DOWNLOADS)); |
| 163 FilePath default_download_path; | 167 FilePath default_download_path; |
| 164 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, | 168 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 258 |
| 255 void ActiveDownloadsHandler::HandlePauseToggleDownload(const ListValue* args) { | 259 void ActiveDownloadsHandler::HandlePauseToggleDownload(const ListValue* args) { |
| 256 DownloadItem* item = GetDownloadById(args); | 260 DownloadItem* item = GetDownloadById(args); |
| 257 if (item && item->IsPartialDownload()) | 261 if (item && item->IsPartialDownload()) |
| 258 item->TogglePause(); | 262 item->TogglePause(); |
| 259 } | 263 } |
| 260 | 264 |
| 261 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) { | 265 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) { |
| 262 DownloadItem* item = GetDownloadById(args); | 266 DownloadItem* item = GetDownloadById(args); |
| 263 if (item) | 267 if (item) |
| 264 download_manager_->DangerousDownloadValidated(item); | 268 item->DangerousDownloadValidated(); |
| 265 } | 269 } |
| 266 | 270 |
| 267 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) { | 271 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) { |
| 268 DownloadItem* item = GetDownloadById(args); | 272 DownloadItem* item = GetDownloadById(args); |
| 269 if (item && item->IsPartialDownload()) { | 273 if (item) { |
| 270 item->Cancel(true); | 274 if (item->IsPartialDownload()) |
| 275 item->Cancel(true); |
| 271 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 276 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 272 } | 277 } |
| 273 } | 278 } |
| 274 | 279 |
| 275 void ActiveDownloadsHandler::OpenNewFullWindow(const ListValue* args) { | 280 void ActiveDownloadsHandler::OpenNewFullWindow(const ListValue* args) { |
| 276 OpenNewWindow(args, false); | 281 OpenNewWindow(args, false); |
| 277 } | 282 } |
| 278 | 283 |
| 279 void ActiveDownloadsHandler::OpenNewPopupWindow(const ListValue* args) { | 284 void ActiveDownloadsHandler::OpenNewPopupWindow(const ListValue* args) { |
| 280 OpenNewWindow(args, true); | 285 OpenNewWindow(args, true); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 if (url.SchemeIs(chrome::kChromeUIScheme) && | 430 if (url.SchemeIs(chrome::kChromeUIScheme) && |
| 426 url.host() == chrome::kChromeUIActiveDownloadsHost && | 431 url.host() == chrome::kChromeUIActiveDownloadsHost && |
| 427 (*it)->profile() == profile) { | 432 (*it)->profile() == profile) { |
| 428 return (*it); | 433 return (*it); |
| 429 } | 434 } |
| 430 } | 435 } |
| 431 } | 436 } |
| 432 return NULL; | 437 return NULL; |
| 433 } | 438 } |
| 434 | 439 |
| OLD | NEW |