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

Side by Side Diff: chrome/browser/ui/webui/settings/md_settings_ui.cc

Issue 2573943002: WebUI: Vulcanize MD Settings at compile time. (Closed)
Patch Set: Nit Created 3 years, 10 months 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 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
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 #else
193 // Add all settings resources. 197 // Add all settings resources.
194 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { 198 for (size_t i = 0; i < kSettingsResourcesSize; ++i) {
195 html_source->AddResourcePath(kSettingsResources[i].name, 199 html_source->AddResourcePath(kSettingsResources[i].name,
196 kSettingsResources[i].value); 200 kSettingsResources[i].value);
197 } 201 }
202 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML);
203 #endif
198 204
199 AddLocalizedStrings(html_source, profile); 205 AddLocalizedStrings(html_source, profile);
200 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML);
201 206
202 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), 207 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
203 html_source); 208 html_source);
204 } 209 }
205 210
206 MdSettingsUI::~MdSettingsUI() { 211 MdSettingsUI::~MdSettingsUI() {
207 } 212 }
208 213
209 void MdSettingsUI::AddSettingsPageUIHandler( 214 void MdSettingsUI::AddSettingsPageUIHandler(
210 std::unique_ptr<SettingsPageUIHandler> handler) { 215 std::unique_ptr<SettingsPageUIHandler> handler) {
(...skipping 15 matching lines...) Expand all
226 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", 231 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD",
227 base::Time::Now() - load_start_time_); 232 base::Time::Now() - load_start_time_);
228 } 233 }
229 234
230 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { 235 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() {
231 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", 236 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD",
232 base::Time::Now() - load_start_time_); 237 base::Time::Now() - load_start_time_);
233 } 238 }
234 239
235 } // namespace settings 240 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698