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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/chrome_thread.h" |
13 #include "chrome/common/jstemplate_builder.h" | 13 #include "chrome/common/jstemplate_builder.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 | 15 |
16 #include "grit/browser_resources.h" | 16 #include "grit/browser_resources.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 | 18 |
19 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
20 // | 20 // |
21 // PrintUI | 21 // PrintUI |
22 // | 22 // |
23 /////////////////////////////////////////////////////////////////////////////// | 23 /////////////////////////////////////////////////////////////////////////////// |
24 | 24 |
25 PrintUI::PrintUI(TabContents* contents) : DOMUI(contents) { | 25 PrintUI::PrintUI(TabContents* contents) : DOMUI(contents) { |
26 PrintUIHTMLSource* html_source = new PrintUIHTMLSource(); | 26 PrintUIHTMLSource* html_source = new PrintUIHTMLSource(); |
27 | 27 |
28 // Set up the print:url source. | 28 // Set up the print:url source. |
29 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 29 ChromeThread::PostTask( |
30 NewRunnableMethod(&chrome_url_data_manager, | 30 ChromeThread::IO, FROM_HERE, |
| 31 NewRunnableMethod( |
| 32 &chrome_url_data_manager, |
31 &ChromeURLDataManager::AddDataSource, | 33 &ChromeURLDataManager::AddDataSource, |
32 html_source)); | 34 html_source)); |
33 } | 35 } |
34 | 36 |
35 //////////////////////////////////////////////////////////////////////////////// | 37 //////////////////////////////////////////////////////////////////////////////// |
36 // | 38 // |
37 // PrintUIHTMLSource | 39 // PrintUIHTMLSource |
38 // | 40 // |
39 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
40 | 42 |
(...skipping 15 matching lines...) Expand all Loading... |
56 IDR_PRINT_TAB_HTML)); | 58 IDR_PRINT_TAB_HTML)); |
57 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 59 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
58 print_html, &localized_strings); | 60 print_html, &localized_strings); |
59 | 61 |
60 // Load the print html page into the tab contents. | 62 // Load the print html page into the tab contents. |
61 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 63 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
62 html_bytes->data.resize(full_html.size()); | 64 html_bytes->data.resize(full_html.size()); |
63 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | 65 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); |
64 SendResponse(request_id, html_bytes); | 66 SendResponse(request_id, html_bytes); |
65 } | 67 } |
OLD | NEW |