| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/print_ui.h" | 5 #include "chrome/browser/dom_ui/print_ui.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 //////////////////////////////////////////////////////////////////////////////// | 39 //////////////////////////////////////////////////////////////////////////////// |
| 40 | 40 |
| 41 PrintUIHTMLSource::PrintUIHTMLSource() | 41 PrintUIHTMLSource::PrintUIHTMLSource() |
| 42 : DataSource(chrome::kPrintScheme, MessageLoop::current()) { | 42 : DataSource(chrome::kPrintScheme, MessageLoop::current()) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void PrintUIHTMLSource::StartDataRequest(const std::string& path, | 45 void PrintUIHTMLSource::StartDataRequest(const std::string& path, |
| 46 int request_id) { | 46 int request_id) { |
| 47 // Setup a dictionary so that the html page could read the values. | 47 // Setup a dictionary so that the html page could read the values. |
| 48 DictionaryValue localized_strings; | 48 DictionaryValue localized_strings; |
| 49 localized_strings.SetString(L"title", | 49 localized_strings.SetString(L"title", l10n_util::GetString(IDS_PRINT)); |
| 50 l10n_util::GetString(IDS_PRINT)); | |
| 51 | 50 |
| 52 SetFontAndTextDirection(&localized_strings); | 51 SetFontAndTextDirection(&localized_strings); |
| 53 | 52 |
| 54 // Setup the print html page. | 53 // Setup the print html page. |
| 55 static const StringPiece print_html( | 54 static const StringPiece print_html( |
| 56 ResourceBundle::GetSharedInstance().GetRawDataResource( | 55 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 57 IDR_PRINT_TAB_HTML)); | 56 IDR_PRINT_TAB_HTML)); |
| 58 const std::string full_html = jstemplate_builder::GetTemplateHtml( | 57 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
| 59 print_html, &localized_strings, "t"); | 58 print_html, &localized_strings); |
| 60 | 59 |
| 61 // Load the print html page into the tab contents. | 60 // Load the print html page into the tab contents. |
| 62 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 61 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 63 html_bytes->data.resize(full_html.size()); | 62 html_bytes->data.resize(full_html.size()); |
| 64 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | 63 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); |
| 65 SendResponse(request_id, html_bytes); | 64 SendResponse(request_id, html_bytes); |
| 66 } | 65 } |
| OLD | NEW |