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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 122 } |
123 // TODO(viettrungluu): this is wrong -- FilePath's need not be Unicode. | 123 // TODO(viettrungluu): this is wrong -- FilePath's need not be Unicode. |
124 localized_strings.SetString("downloadpath", default_download_path.value()); | 124 localized_strings.SetString("downloadpath", default_download_path.value()); |
125 localized_strings.SetString("error_unknown_file_type", | 125 localized_strings.SetString("error_unknown_file_type", |
126 l10n_util::GetStringUTF16(IDS_FILEBROWSER_ERROR_UNKNOWN_FILE_TYPE)); | 126 l10n_util::GetStringUTF16(IDS_FILEBROWSER_ERROR_UNKNOWN_FILE_TYPE)); |
127 SetFontAndTextDirection(&localized_strings); | 127 SetFontAndTextDirection(&localized_strings); |
128 | 128 |
129 static const base::StringPiece active_downloads_html( | 129 static const base::StringPiece active_downloads_html( |
130 ResourceBundle::GetSharedInstance().GetRawDataResource( | 130 ResourceBundle::GetSharedInstance().GetRawDataResource( |
131 IDR_ACTIVE_DOWNLOADS_HTML)); | 131 IDR_ACTIVE_DOWNLOADS_HTML)); |
132 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 132 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
133 active_downloads_html, &localized_strings); | 133 active_downloads_html, &localized_strings); |
134 | 134 |
135 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 135 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); |
136 html_bytes->data.resize(full_html.size()); | |
137 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | |
138 | |
139 SendResponse(request_id, html_bytes); | |
140 } | 136 } |
141 | 137 |
142 } // namespace | 138 } // namespace |
143 | 139 |
144 //////////////////////////////////////////////////////////////////////////////// | 140 //////////////////////////////////////////////////////////////////////////////// |
145 // | 141 // |
146 // ActiveDownloadsHandler | 142 // ActiveDownloadsHandler |
147 // | 143 // |
148 //////////////////////////////////////////////////////////////////////////////// | 144 //////////////////////////////////////////////////////////////////////////////// |
149 | 145 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 return (*it); | 429 return (*it); |
434 } | 430 } |
435 } | 431 } |
436 } | 432 } |
437 return NULL; | 433 return NULL; |
438 } | 434 } |
439 | 435 |
440 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { | 436 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { |
441 return handler_->downloads(); | 437 return handler_->downloads(); |
442 } | 438 } |
OLD | NEW |