| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 #endif | 183 #endif |
| 184 | 184 |
| 185 AddSettingsPageUIHandler( | 185 AddSettingsPageUIHandler( |
| 186 base::WrapUnique(AboutHandler::Create(html_source, profile))); | 186 base::WrapUnique(AboutHandler::Create(html_source, profile))); |
| 187 AddSettingsPageUIHandler( | 187 AddSettingsPageUIHandler( |
| 188 base::WrapUnique(ResetSettingsHandler::Create(html_source, profile))); | 188 base::WrapUnique(ResetSettingsHandler::Create(html_source, profile))); |
| 189 | 189 |
| 190 // Add the metrics handler to write uma stats. | 190 // Add the metrics handler to write uma stats. |
| 191 web_ui->AddMessageHandler(base::MakeUnique<MetricsHandler>()); | 191 web_ui->AddMessageHandler(base::MakeUnique<MetricsHandler>()); |
| 192 | 192 |
| 193 #if BUILDFLAG(USE_VULCANIZE) | |
| 194 html_source->AddResourcePath("crisper.js", IDR_MD_SETTINGS_CRISPER_JS); | |
| 195 html_source->SetDefaultResource(IDR_MD_SETTINGS_VULCANIZED_HTML); | |
| 196 html_source->UseGzip(std::unordered_set<std::string>()); | |
| 197 #else | |
| 198 // Add all settings resources. | 193 // Add all settings resources. |
| 199 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { | 194 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { |
| 200 html_source->AddResourcePath(kSettingsResources[i].name, | 195 html_source->AddResourcePath(kSettingsResources[i].name, |
| 201 kSettingsResources[i].value); | 196 kSettingsResources[i].value); |
| 202 } | 197 } |
| 203 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); | |
| 204 #endif | |
| 205 | 198 |
| 206 AddLocalizedStrings(html_source, profile); | 199 AddLocalizedStrings(html_source, profile); |
| 200 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); |
| 207 | 201 |
| 208 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 202 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 209 html_source); | 203 html_source); |
| 210 } | 204 } |
| 211 | 205 |
| 212 MdSettingsUI::~MdSettingsUI() { | 206 MdSettingsUI::~MdSettingsUI() { |
| 213 } | 207 } |
| 214 | 208 |
| 215 void MdSettingsUI::AddSettingsPageUIHandler( | 209 void MdSettingsUI::AddSettingsPageUIHandler( |
| 216 std::unique_ptr<SettingsPageUIHandler> handler) { | 210 std::unique_ptr<SettingsPageUIHandler> handler) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 232 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", | 226 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", |
| 233 base::Time::Now() - load_start_time_); | 227 base::Time::Now() - load_start_time_); |
| 234 } | 228 } |
| 235 | 229 |
| 236 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { | 230 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { |
| 237 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", | 231 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", |
| 238 base::Time::Now() - load_start_time_); | 232 base::Time::Now() - load_start_time_); |
| 239 } | 233 } |
| 240 | 234 |
| 241 } // namespace settings | 235 } // namespace settings |
| OLD | NEW |