OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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/downloads_ui.h" | 5 #include "chrome/browser/dom_ui/downloads_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/singleton.h" |
9 #include "base/string_piece.h" | 10 #include "base/string_piece.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/browser/dom_ui/chrome_url_data_manager.h" | 14 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
14 #include "chrome/browser/dom_ui/downloads_dom_handler.h" | 15 #include "chrome/browser/dom_ui/downloads_dom_handler.h" |
15 #include "chrome/browser/download/download_manager.h" | 16 #include "chrome/browser/download/download_manager.h" |
16 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
17 #include "chrome/common/jstemplate_builder.h" | 18 #include "chrome/common/jstemplate_builder.h" |
18 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 DownloadsDOMHandler* handler = new DownloadsDOMHandler(dlm); | 128 DownloadsDOMHandler* handler = new DownloadsDOMHandler(dlm); |
128 AddMessageHandler(handler); | 129 AddMessageHandler(handler); |
129 handler->Attach(this); | 130 handler->Attach(this); |
130 handler->Init(); | 131 handler->Init(); |
131 | 132 |
132 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource(); | 133 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource(); |
133 | 134 |
134 // Set up the chrome://downloads/ source. | 135 // Set up the chrome://downloads/ source. |
135 ChromeThread::PostTask( | 136 ChromeThread::PostTask( |
136 ChromeThread::IO, FROM_HERE, | 137 ChromeThread::IO, FROM_HERE, |
137 NewRunnableMethod(&chrome_url_data_manager, | 138 NewRunnableMethod(Singleton<ChromeURLDataManager>().get(), |
138 &ChromeURLDataManager::AddDataSource, | 139 &ChromeURLDataManager::AddDataSource, |
139 html_source)); | 140 html_source)); |
140 } | 141 } |
141 | 142 |
142 // static | 143 // static |
143 RefCountedMemory* DownloadsUI::GetFaviconResourceBytes() { | 144 RefCountedMemory* DownloadsUI::GetFaviconResourceBytes() { |
144 return ResourceBundle::GetSharedInstance(). | 145 return ResourceBundle::GetSharedInstance(). |
145 LoadImageResourceBytes(IDR_DOWNLOADS_FAVICON); | 146 LoadImageResourceBytes(IDR_DOWNLOADS_FAVICON); |
146 } | 147 } |
OLD | NEW |