Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: chrome/browser/ui/webui/active_downloads_ui.cc

Issue 6948013: Fix dangerous downloads. Ellipsis for long filenames. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 void ActiveDownloadsUIHTMLSource::StartDataRequest(const std::string& path, 146 void ActiveDownloadsUIHTMLSource::StartDataRequest(const std::string& path,
147 bool is_incognito, 147 bool is_incognito,
148 int request_id) { 148 int request_id) {
149 DictionaryValue localized_strings; 149 DictionaryValue localized_strings;
150 localized_strings.SetString("allowdownload", 150 localized_strings.SetString("allowdownload",
151 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_DOWNLOAD)); 151 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_DOWNLOAD));
152 localized_strings.SetString("cancel", 152 localized_strings.SetString("cancel",
153 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_CANCEL)); 153 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_CANCEL));
154 localized_strings.SetString("confirmcancel",
155 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_CANCEL));
156 localized_strings.SetString("confirmyes",
157 l10n_util::GetStringUTF16(IDS_FILEBROWSER_CONFIRM_YES));
154 localized_strings.SetString("open", 158 localized_strings.SetString("open",
155 l10n_util::GetStringUTF16(IDS_FILEBROWSER_OPEN)); 159 l10n_util::GetStringUTF16(IDS_FILEBROWSER_OPEN));
156 localized_strings.SetString("pause", 160 localized_strings.SetString("pause",
157 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_PAUSE)); 161 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_PAUSE));
158 localized_strings.SetString("resume", 162 localized_strings.SetString("resume",
159 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_RESUME)); 163 l10n_util::GetStringUTF16(IDS_DOWNLOAD_LINK_RESUME));
160 localized_strings.SetString("showalldownloads", 164 localized_strings.SetString("showalldownloads",
161 l10n_util::GetStringUTF16(IDS_FILEBROWSER_SHOW_ALL_DOWNLOADS)); 165 l10n_util::GetStringUTF16(IDS_FILEBROWSER_SHOW_ALL_DOWNLOADS));
162 FilePath default_download_path; 166 FilePath default_download_path;
163 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, 167 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 257
254 void ActiveDownloadsHandler::HandlePauseToggleDownload(const ListValue* args) { 258 void ActiveDownloadsHandler::HandlePauseToggleDownload(const ListValue* args) {
255 DownloadItem* item = GetDownloadById(args); 259 DownloadItem* item = GetDownloadById(args);
256 if (item && item->IsPartialDownload()) 260 if (item && item->IsPartialDownload())
257 item->TogglePause(); 261 item->TogglePause();
258 } 262 }
259 263
260 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) { 264 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) {
261 DownloadItem* item = GetDownloadById(args); 265 DownloadItem* item = GetDownloadById(args);
262 if (item) 266 if (item)
263 download_manager_->DangerousDownloadValidated(item); 267 item->DangerousDownloadValidated();
264 } 268 }
265 269
266 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) { 270 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) {
267 DownloadItem* item = GetDownloadById(args); 271 DownloadItem* item = GetDownloadById(args);
268 if (item && item->IsPartialDownload()) { 272 if (item) {
269 item->Cancel(true); 273 if (item->IsPartialDownload())
274 item->Cancel(true);
270 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 275 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
271 } 276 }
272 } 277 }
273 278
274 void ActiveDownloadsHandler::OpenNewFullWindow(const ListValue* args) { 279 void ActiveDownloadsHandler::OpenNewFullWindow(const ListValue* args) {
275 OpenNewWindow(args, false); 280 OpenNewWindow(args, false);
276 } 281 }
277 282
278 void ActiveDownloadsHandler::OpenNewPopupWindow(const ListValue* args) { 283 void ActiveDownloadsHandler::OpenNewPopupWindow(const ListValue* args) {
279 OpenNewWindow(args, true); 284 OpenNewWindow(args, true);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 if (url.SchemeIs(chrome::kChromeUIScheme) && 427 if (url.SchemeIs(chrome::kChromeUIScheme) &&
423 url.host() == chrome::kChromeUIActiveDownloadsHost && 428 url.host() == chrome::kChromeUIActiveDownloadsHost &&
424 (*it)->profile() == profile) { 429 (*it)->profile() == profile) {
425 return (*it); 430 return (*it);
426 } 431 }
427 } 432 }
428 } 433 }
429 return NULL; 434 return NULL;
430 } 435 }
431 436
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698