| 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 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 AddSettingsPageUIHandler( | 175 AddSettingsPageUIHandler( |
| 176 base::WrapUnique(AboutHandler::Create(html_source, profile))); | 176 base::WrapUnique(AboutHandler::Create(html_source, profile))); |
| 177 AddSettingsPageUIHandler( | 177 AddSettingsPageUIHandler( |
| 178 base::WrapUnique(ResetSettingsHandler::Create(html_source, profile))); | 178 base::WrapUnique(ResetSettingsHandler::Create(html_source, profile))); |
| 179 | 179 |
| 180 // Add the metrics handler to write uma stats. | 180 // Add the metrics handler to write uma stats. |
| 181 web_ui->AddMessageHandler(base::MakeUnique<MetricsHandler>()); | 181 web_ui->AddMessageHandler(base::MakeUnique<MetricsHandler>()); |
| 182 | 182 |
| 183 #if BUILDFLAG(USE_VULCANIZE) |
| 184 html_source->AddResourcePath("crisper.js", |
| 185 IDR_MD_SETTINGS_CRISPER_JS); |
| 186 html_source->SetDefaultResource(IDR_MD_SETTINGS_VULCANIZED_HTML); |
| 187 #else |
| 183 // Add all settings resources. | 188 // Add all settings resources. |
| 184 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { | 189 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { |
| 185 html_source->AddResourcePath(kSettingsResources[i].name, | 190 html_source->AddResourcePath(kSettingsResources[i].name, |
| 186 kSettingsResources[i].value); | 191 kSettingsResources[i].value); |
| 187 } | 192 } |
| 193 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); |
| 194 #endif |
| 188 | 195 |
| 189 AddLocalizedStrings(html_source, profile); | 196 AddLocalizedStrings(html_source, profile); |
| 190 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); | |
| 191 | 197 |
| 192 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 198 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 193 html_source); | 199 html_source); |
| 194 } | 200 } |
| 195 | 201 |
| 196 MdSettingsUI::~MdSettingsUI() { | 202 MdSettingsUI::~MdSettingsUI() { |
| 197 } | 203 } |
| 198 | 204 |
| 199 void MdSettingsUI::AddSettingsPageUIHandler( | 205 void MdSettingsUI::AddSettingsPageUIHandler( |
| 200 std::unique_ptr<SettingsPageUIHandler> handler) { | 206 std::unique_ptr<SettingsPageUIHandler> handler) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 216 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", | 222 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", |
| 217 base::Time::Now() - load_start_time_); | 223 base::Time::Now() - load_start_time_); |
| 218 } | 224 } |
| 219 | 225 |
| 220 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { | 226 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { |
| 221 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", | 227 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", |
| 222 base::Time::Now() - load_start_time_); | 228 base::Time::Now() - load_start_time_); |
| 223 } | 229 } |
| 224 | 230 |
| 225 } // namespace settings | 231 } // namespace settings |
| OLD | NEW |