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

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: Rebase 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 html_source->UseGzip(std::unordered_set<std::string>());
197 #else
193 // Add all settings resources. 198 // Add all settings resources.
194 for (size_t i = 0; i < kSettingsResourcesSize; ++i) { 199 for (size_t i = 0; i < kSettingsResourcesSize; ++i) {
195 html_source->AddResourcePath(kSettingsResources[i].name, 200 html_source->AddResourcePath(kSettingsResources[i].name,
196 kSettingsResources[i].value); 201 kSettingsResources[i].value);
197 } 202 }
203 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML);
204 #endif
198 205
199 AddLocalizedStrings(html_source, profile); 206 AddLocalizedStrings(html_source, profile);
200 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML);
201 207
202 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), 208 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
203 html_source); 209 html_source);
204 } 210 }
205 211
206 MdSettingsUI::~MdSettingsUI() { 212 MdSettingsUI::~MdSettingsUI() {
207 } 213 }
208 214
209 void MdSettingsUI::AddSettingsPageUIHandler( 215 void MdSettingsUI::AddSettingsPageUIHandler(
210 std::unique_ptr<SettingsPageUIHandler> handler) { 216 std::unique_ptr<SettingsPageUIHandler> handler) {
(...skipping 15 matching lines...) Expand all
226 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", 232 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD",
227 base::Time::Now() - load_start_time_); 233 base::Time::Now() - load_start_time_);
228 } 234 }
229 235
230 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { 236 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() {
231 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", 237 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD",
232 base::Time::Now() - load_start_time_); 238 base::Time::Now() - load_start_time_);
233 } 239 }
234 240
235 } // namespace settings 241 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_resources_vulcanized.grd ('k') | tools/gritsettings/resource_ids » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698