| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/singleton.h" | 7 #include "base/singleton.h" |
| 8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_thread.h" | 11 #include "chrome/browser/browser_thread.h" |
| 12 #include "chrome/browser/defaults.h" | 12 #include "chrome/browser/defaults.h" |
| 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 14 #include "chrome/browser/dom_ui/downloads_dom_handler.h" | 14 #include "chrome/browser/dom_ui/downloads_dom_handler.h" |
| 15 #include "chrome/browser/download/download_manager.h" | 15 #include "chrome/browser/download/download_manager.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 18 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
| 19 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 20 #include "grit/browser_resources.h" | 19 #include "grit/browser_resources.h" |
| 21 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 22 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 DownloadManager* dlm = GetProfile()->GetDownloadManager(); | 127 DownloadManager* dlm = GetProfile()->GetDownloadManager(); |
| 129 | 128 |
| 130 DownloadsDOMHandler* handler = new DownloadsDOMHandler(dlm); | 129 DownloadsDOMHandler* handler = new DownloadsDOMHandler(dlm); |
| 131 AddMessageHandler(handler); | 130 AddMessageHandler(handler); |
| 132 handler->Attach(this); | 131 handler->Attach(this); |
| 133 handler->Init(); | 132 handler->Init(); |
| 134 | 133 |
| 135 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource(); | 134 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource(); |
| 136 | 135 |
| 137 // Set up the chrome://downloads/ source. | 136 // Set up the chrome://downloads/ source. |
| 138 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 137 BrowserThread::PostTask( |
| 138 BrowserThread::IO, FROM_HERE, |
| 139 NewRunnableMethod(ChromeURLDataManager::GetInstance(), |
| 140 &ChromeURLDataManager::AddDataSource, |
| 141 make_scoped_refptr(html_source))); |
| 139 } | 142 } |
| 140 | 143 |
| 141 // static | 144 // static |
| 142 RefCountedMemory* DownloadsUI::GetFaviconResourceBytes() { | 145 RefCountedMemory* DownloadsUI::GetFaviconResourceBytes() { |
| 143 return ResourceBundle::GetSharedInstance(). | 146 return ResourceBundle::GetSharedInstance(). |
| 144 LoadDataResourceBytes(IDR_DOWNLOADS_FAVICON); | 147 LoadDataResourceBytes(IDR_DOWNLOADS_FAVICON); |
| 145 } | 148 } |
| OLD | NEW |