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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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", l10n_util::GetString(IDS_PRINT)); | 49 localized_strings.SetString(L"title", l10n_util::GetString(IDS_PRINT)); |
50 | 50 |
51 SetFontAndTextDirection(&localized_strings); | 51 SetFontAndTextDirection(&localized_strings); |
52 | 52 |
53 // Setup the print html page. | 53 // Setup the print html page. |
54 static const StringPiece print_html( | 54 static const base::StringPiece print_html( |
55 ResourceBundle::GetSharedInstance().GetRawDataResource( | 55 ResourceBundle::GetSharedInstance().GetRawDataResource( |
56 IDR_PRINT_TAB_HTML)); | 56 IDR_PRINT_TAB_HTML)); |
57 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 57 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
58 print_html, &localized_strings); | 58 print_html, &localized_strings); |
59 | 59 |
60 // Load the print html page into the tab contents. | 60 // Load the print html page into the tab contents. |
61 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 61 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
62 html_bytes->data.resize(full_html.size()); | 62 html_bytes->data.resize(full_html.size()); |
63 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()); |
64 SendResponse(request_id, html_bytes); | 64 SendResponse(request_id, html_bytes); |
65 } | 65 } |
OLD | NEW |