OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/md_settings_ui.h" | 5 #include "chrome/browser/ui/webui/settings/md_settings_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/webui/metrics_handler.h" |
13 #include "chrome/browser/ui/webui/settings/about_handler.h" | 14 #include "chrome/browser/ui/webui/settings/about_handler.h" |
14 #include "chrome/browser/ui/webui/settings/appearance_handler.h" | 15 #include "chrome/browser/ui/webui/settings/appearance_handler.h" |
15 #include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h" | 16 #include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h" |
16 #include "chrome/browser/ui/webui/settings/downloads_handler.h" | 17 #include "chrome/browser/ui/webui/settings/downloads_handler.h" |
17 #include "chrome/browser/ui/webui/settings/font_handler.h" | 18 #include "chrome/browser/ui/webui/settings/font_handler.h" |
18 #include "chrome/browser/ui/webui/settings/languages_handler.h" | 19 #include "chrome/browser/ui/webui/settings/languages_handler.h" |
19 #include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provide
r.h" | 20 #include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provide
r.h" |
20 #include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h" | 21 #include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h" |
21 #include "chrome/browser/ui/webui/settings/people_handler.h" | 22 #include "chrome/browser/ui/webui/settings/people_handler.h" |
22 #include "chrome/browser/ui/webui/settings/profile_info_handler.h" | 23 #include "chrome/browser/ui/webui/settings/profile_info_handler.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 AddSettingsPageUIHandler(easy_unlock_handler); | 120 AddSettingsPageUIHandler(easy_unlock_handler); |
120 | 121 |
121 html_source->AddBoolean("stylusAllowed", ash::IsPaletteFeatureEnabled()); | 122 html_source->AddBoolean("stylusAllowed", ash::IsPaletteFeatureEnabled()); |
122 html_source->AddBoolean("quickUnlockEnabled", | 123 html_source->AddBoolean("quickUnlockEnabled", |
123 chromeos::IsQuickUnlockEnabled()); | 124 chromeos::IsQuickUnlockEnabled()); |
124 #endif | 125 #endif |
125 | 126 |
126 AddSettingsPageUIHandler(AboutHandler::Create(html_source, profile)); | 127 AddSettingsPageUIHandler(AboutHandler::Create(html_source, profile)); |
127 AddSettingsPageUIHandler(ResetSettingsHandler::Create(html_source, profile)); | 128 AddSettingsPageUIHandler(ResetSettingsHandler::Create(html_source, profile)); |
128 | 129 |
| 130 // Add the metrics handler to write uma stats. |
| 131 web_ui->AddMessageHandler(new MetricsHandler()); |
| 132 |
129 // Add all settings resources. | 133 // Add all settings resources. |
130 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { | 134 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { |
131 html_source->AddResourcePath(kSettingsResources[i].name, | 135 html_source->AddResourcePath(kSettingsResources[i].name, |
132 kSettingsResources[i].value); | 136 kSettingsResources[i].value); |
133 } | 137 } |
134 | 138 |
135 AddLocalizedStrings(html_source, profile); | 139 AddLocalizedStrings(html_source, profile); |
136 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); | 140 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); |
137 | 141 |
138 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 142 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
(...skipping 22 matching lines...) Expand all Loading... |
161 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", | 165 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", |
162 base::Time::Now() - load_start_time_); | 166 base::Time::Now() - load_start_time_); |
163 } | 167 } |
164 | 168 |
165 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { | 169 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { |
166 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", | 170 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", |
167 base::Time::Now() - load_start_time_); | 171 base::Time::Now() - load_start_time_); |
168 } | 172 } |
169 | 173 |
170 } // namespace settings | 174 } // namespace settings |
OLD | NEW |