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

Side by Side Diff: chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc

Issue 1428833005: MD Downloads: track downloads in C++, dispatch discrete JS updates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years 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
OLDNEW
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/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 /////////////////////////////////////////////////////////////////////////////// 135 ///////////////////////////////////////////////////////////////////////////////
136 // 136 //
137 // MdDownloadsUI 137 // MdDownloadsUI
138 // 138 //
139 /////////////////////////////////////////////////////////////////////////////// 139 ///////////////////////////////////////////////////////////////////////////////
140 140
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 MdDownloadsDOMHandler* handler = new MdDownloadsDOMHandler(dlm); 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) 151 #if defined(ENABLE_THEMES)
152 ThemeSource* theme = new ThemeSource(profile); 152 ThemeSource* theme = new ThemeSource(profile);
153 content::URLDataSource::Add(profile, theme); 153 content::URLDataSource::Add(profile, theme);
154 #endif 154 #endif
155 } 155 }
156 156
157 // static 157 // static
158 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes( 158 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes(
159 ui::ScaleFactor scale_factor) { 159 ui::ScaleFactor scale_factor) {
160 return ResourceBundle::GetSharedInstance(). 160 return ResourceBundle::GetSharedInstance().
161 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); 161 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor);
162 } 162 }
163
164 void MdDownloadsUI::RenderViewReused(
165 content::RenderViewHost* render_view_host) {
166 handler_->RenderViewReused(render_view_host);
167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698