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

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

Issue 2592573002: MD Downloads: add first meaningful paint metrics to UMA (Closed)
Patch Set: -history Created 4 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/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/defaults.h" 12 #include "chrome/browser/defaults.h"
13 #include "chrome/browser/download/download_service.h" 13 #include "chrome/browser/download/download_service.h"
14 #include "chrome/browser/download/download_service_factory.h" 14 #include "chrome/browser/download/download_service_factory.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h" 16 #include "chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h"
17 #include "chrome/browser/ui/webui/metrics_handler.h"
17 #include "chrome/browser/ui/webui/theme_source.h" 18 #include "chrome/browser/ui/webui/theme_source.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/features.h" 20 #include "chrome/common/features.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "chrome/grit/browser_resources.h" 23 #include "chrome/grit/browser_resources.h"
23 #include "chrome/grit/chromium_strings.h" 24 #include "chrome/grit/chromium_strings.h"
24 #include "chrome/grit/generated_resources.h" 25 #include "chrome/grit/generated_resources.h"
25 #include "chrome/grit/theme_resources.h" 26 #include "chrome/grit/theme_resources.h"
26 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // MdDownloadsUI 138 // MdDownloadsUI
138 // 139 //
139 /////////////////////////////////////////////////////////////////////////////// 140 ///////////////////////////////////////////////////////////////////////////////
140 141
141 MdDownloadsUI::MdDownloadsUI(content::WebUI* web_ui) : WebUIController(web_ui) { 142 MdDownloadsUI::MdDownloadsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
142 Profile* profile = Profile::FromWebUI(web_ui); 143 Profile* profile = Profile::FromWebUI(web_ui);
143 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile); 144 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile);
144 145
145 handler_ = new MdDownloadsDOMHandler(dlm, web_ui); 146 handler_ = new MdDownloadsDOMHandler(dlm, web_ui);
146 web_ui->AddMessageHandler(handler_); 147 web_ui->AddMessageHandler(handler_);
148 web_ui->AddMessageHandler(new MetricsHandler);
147 149
148 // Set up the chrome://downloads/ source. 150 // Set up the chrome://downloads/ source.
149 content::WebUIDataSource* source = CreateDownloadsUIHTMLSource(profile); 151 content::WebUIDataSource* source = CreateDownloadsUIHTMLSource(profile);
150 content::WebUIDataSource::Add(profile, source); 152 content::WebUIDataSource::Add(profile, source);
151 ThemeSource* theme = new ThemeSource(profile); 153 ThemeSource* theme = new ThemeSource(profile);
152 content::URLDataSource::Add(profile, theme); 154 content::URLDataSource::Add(profile, theme);
153 } 155 }
154 156
155 // static 157 // static
156 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes( 158 base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes(
157 ui::ScaleFactor scale_factor) { 159 ui::ScaleFactor scale_factor) {
158 return ResourceBundle::GetSharedInstance(). 160 return ResourceBundle::GetSharedInstance().
159 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor); 161 LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor);
160 } 162 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_downloads/manager.js ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698