Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/browser/dom_ui/print_ui.cc

Issue 350007: Convert chrome_url_data_manager (previously a global) into a Singleton. This (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.cc ('k') | chrome/browser/extensions/extensions_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/singleton.h"
10 #include "base/thread.h" 11 #include "base/thread.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/browser/chrome_thread.h" 13 #include "chrome/browser/chrome_thread.h"
13 #include "chrome/common/jstemplate_builder.h" 14 #include "chrome/common/jstemplate_builder.h"
14 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
15 16
16 #include "grit/browser_resources.h" 17 #include "grit/browser_resources.h"
17 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
18 19
19 /////////////////////////////////////////////////////////////////////////////// 20 ///////////////////////////////////////////////////////////////////////////////
20 // 21 //
21 // PrintUI 22 // PrintUI
22 // 23 //
23 /////////////////////////////////////////////////////////////////////////////// 24 ///////////////////////////////////////////////////////////////////////////////
24 25
25 PrintUI::PrintUI(TabContents* contents) : DOMUI(contents) { 26 PrintUI::PrintUI(TabContents* contents) : DOMUI(contents) {
26 PrintUIHTMLSource* html_source = new PrintUIHTMLSource(); 27 PrintUIHTMLSource* html_source = new PrintUIHTMLSource();
27 28
28 // Set up the print:url source. 29 // Set up the print:url source.
29 ChromeThread::PostTask( 30 ChromeThread::PostTask(
30 ChromeThread::IO, FROM_HERE, 31 ChromeThread::IO, FROM_HERE,
31 NewRunnableMethod( 32 NewRunnableMethod(
32 &chrome_url_data_manager, 33 Singleton<ChromeURLDataManager>().get(),
33 &ChromeURLDataManager::AddDataSource, 34 &ChromeURLDataManager::AddDataSource,
34 html_source)); 35 html_source));
35 } 36 }
36 37
37 //////////////////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////////////////
38 // 39 //
39 // PrintUIHTMLSource 40 // PrintUIHTMLSource
40 // 41 //
41 //////////////////////////////////////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////////////////
42 43
(...skipping 15 matching lines...) Expand all
58 IDR_PRINT_TAB_HTML)); 59 IDR_PRINT_TAB_HTML));
59 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( 60 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
60 print_html, &localized_strings); 61 print_html, &localized_strings);
61 62
62 // Load the print html page into the tab contents. 63 // Load the print html page into the tab contents.
63 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 64 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
64 html_bytes->data.resize(full_html.size()); 65 html_bytes->data.resize(full_html.size());
65 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); 66 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
66 SendResponse(request_id, html_bytes); 67 SendResponse(request_id, html_bytes);
67 } 68 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.cc ('k') | chrome/browser/extensions/extensions_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698