| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/md_downloads/md_downloads_ui.h" | 5 #include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 MdDownloadsUI::MdDownloadsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 141 MdDownloadsUI::MdDownloadsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 142 Profile* profile = Profile::FromWebUI(web_ui); | 142 Profile* profile = Profile::FromWebUI(web_ui); |
| 143 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile); | 143 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile); |
| 144 | 144 |
| 145 handler_ = new MdDownloadsDOMHandler(dlm, web_ui); | 145 handler_ = new MdDownloadsDOMHandler(dlm, web_ui); |
| 146 web_ui->AddMessageHandler(handler_); | 146 web_ui->AddMessageHandler(handler_); |
| 147 | 147 |
| 148 // Set up the chrome://downloads/ source. | 148 // Set up the chrome://downloads/ source. |
| 149 content::WebUIDataSource* source = CreateDownloadsUIHTMLSource(profile); | 149 content::WebUIDataSource* source = CreateDownloadsUIHTMLSource(profile); |
| 150 content::WebUIDataSource::Add(profile, source); | 150 content::WebUIDataSource::Add(profile, source); |
| 151 #if defined(ENABLE_THEMES) | |
| 152 ThemeSource* theme = new ThemeSource(profile); | 151 ThemeSource* theme = new ThemeSource(profile); |
| 153 content::URLDataSource::Add(profile, theme); | 152 content::URLDataSource::Add(profile, theme); |
| 154 #endif | |
| 155 } | 153 } |
| 156 | 154 |
| 157 // static | 155 // static |
| 158 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes( | 156 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes( |
| 159 ui::ScaleFactor scale_factor) { | 157 ui::ScaleFactor scale_factor) { |
| 160 return ResourceBundle::GetSharedInstance(). | 158 return ResourceBundle::GetSharedInstance(). |
| 161 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); | 159 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); |
| 162 } | 160 } |
| OLD | NEW |