| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/dom_ui/downloads_ui.h" | 5 #include "chrome/browser/dom_ui/downloads_ui.h" |
| 6 | 6 |
| 7 #include "base/gfx/png_encoder.h" | 7 #include "base/gfx/png_encoder.h" |
| 8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "base/time_format.h" | 10 #include "base/time_format.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Controls. | 87 // Controls. |
| 88 localized_strings.SetString(L"control_pause", | 88 localized_strings.SetString(L"control_pause", |
| 89 l10n_util::GetString(IDS_DOWNLOAD_LINK_PAUSE)); | 89 l10n_util::GetString(IDS_DOWNLOAD_LINK_PAUSE)); |
| 90 localized_strings.SetString(L"control_showinfolder", | 90 localized_strings.SetString(L"control_showinfolder", |
| 91 l10n_util::GetString(IDS_DOWNLOAD_LINK_SHOW)); | 91 l10n_util::GetString(IDS_DOWNLOAD_LINK_SHOW)); |
| 92 localized_strings.SetString(L"control_cancel", | 92 localized_strings.SetString(L"control_cancel", |
| 93 l10n_util::GetString(IDS_DOWNLOAD_LINK_CANCEL)); | 93 l10n_util::GetString(IDS_DOWNLOAD_LINK_CANCEL)); |
| 94 localized_strings.SetString(L"control_resume", | 94 localized_strings.SetString(L"control_resume", |
| 95 l10n_util::GetString(IDS_DOWNLOAD_LINK_RESUME)); | 95 l10n_util::GetString(IDS_DOWNLOAD_LINK_RESUME)); |
| 96 | 96 |
| 97 localized_strings.SetString(L"textdirection", | 97 SetFontAndTextDirection(&localized_strings); |
| 98 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | |
| 99 L"rtl" : L"ltr"); | |
| 100 | 98 |
| 101 static const StringPiece downloads_html( | 99 static const StringPiece downloads_html( |
| 102 ResourceBundle::GetSharedInstance().GetRawDataResource( | 100 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 103 IDR_DOWNLOADS_HTML)); | 101 IDR_DOWNLOADS_HTML)); |
| 104 const std::string full_html = jstemplate_builder::GetTemplateHtml( | 102 const std::string full_html = jstemplate_builder::GetTemplateHtml( |
| 105 downloads_html, &localized_strings, "t"); | 103 downloads_html, &localized_strings, "t"); |
| 106 | 104 |
| 107 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 105 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 108 html_bytes->data.resize(full_html.size()); | 106 html_bytes->data.resize(full_html.size()); |
| 109 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | 107 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 handler->Init(); | 502 handler->Init(); |
| 505 | 503 |
| 506 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource(); | 504 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource(); |
| 507 | 505 |
| 508 // Set up the chrome-ui://downloads/ source. | 506 // Set up the chrome-ui://downloads/ source. |
| 509 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 507 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
| 510 NewRunnableMethod(&chrome_url_data_manager, | 508 NewRunnableMethod(&chrome_url_data_manager, |
| 511 &ChromeURLDataManager::AddDataSource, | 509 &ChromeURLDataManager::AddDataSource, |
| 512 html_source)); | 510 html_source)); |
| 513 } | 511 } |
| OLD | NEW |