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

Side by Side Diff: chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc

Issue 2615013002: gzip VR Shell's UI resources (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/vr_shell/vr_shell_ui_ui.h" 5 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h" 8 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/web_ui.h" 10 #include "content/public/browser/web_ui.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } else { 176 } else {
177 it->second.Run(base::RefCountedString::TakeString(&response)); 177 it->second.Run(base::RefCountedString::TakeString(&response));
178 } 178 }
179 delete source; 179 delete source;
180 pending_.erase(it); 180 pending_.erase(it);
181 } 181 }
182 #else 182 #else
183 content::WebUIDataSource* CreateVrShellUIHTMLSource() { 183 content::WebUIDataSource* CreateVrShellUIHTMLSource() {
184 content::WebUIDataSource* source = 184 content::WebUIDataSource* source =
185 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost); 185 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost);
186 std::unordered_set<std::string> excluded_paths;
187 source->UseGzip(excluded_paths);
Dan Beam 2017/01/05 17:22:17 source->UseGzip(std::unordered_set<std::string>())
mthiesse 2017/01/05 17:25:37 Done.
186 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS); 188 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS);
187 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS); 189 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS);
188 source->AddResourcePath("vr_shell_ui_api.js", IDR_VR_SHELL_UI_API_JS); 190 source->AddResourcePath("vr_shell_ui_api.js", IDR_VR_SHELL_UI_API_JS);
189 source->AddResourcePath("vr_shell_ui_scene.js", IDR_VR_SHELL_UI_SCENE_JS); 191 source->AddResourcePath("vr_shell_ui_scene.js", IDR_VR_SHELL_UI_SCENE_JS);
190 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); 192 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML);
191 // We're localizing strings, so we can't currently use gzip since it's
192 // incompatible with i18n. TODO(klausw): re-enable gzip once an i18n
193 // compatible variant of WebUIDataSource's UseGzip gets added, and add
194 // compress=gzip to browser_resources.grd as appropriate.
195 source->AddLocalizedString( 193 source->AddLocalizedString(
196 "insecureWebVrContentPermanent", 194 "insecureWebVrContentPermanent",
197 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT); 195 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT);
198 source->AddLocalizedString( 196 source->AddLocalizedString(
199 "insecureWebVrContentTransient", 197 "insecureWebVrContentTransient",
200 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT); 198 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT);
201 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON); 199 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON);
202 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON); 200 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON);
203 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON); 201 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON);
204 202
205 return source; 203 return source;
206 } 204 }
207 #endif 205 #endif
208 206
209 } // namespace 207 } // namespace
210 208
211 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) { 209 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) {
212 Profile* profile = Profile::FromWebUI(web_ui); 210 Profile* profile = Profile::FromWebUI(web_ui);
213 #if !defined(ENABLE_VR_SHELL_UI_DEV) 211 #if !defined(ENABLE_VR_SHELL_UI_DEV)
214 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); 212 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource());
215 #else 213 #else
216 content::URLDataSource::Add( 214 content::URLDataSource::Add(
217 profile, new RemoteDataSource(profile->GetRequestContext())); 215 profile, new RemoteDataSource(profile->GetRequestContext()));
218 #endif 216 #endif
219 web_ui->AddMessageHandler(new VrShellUIMessageHandler); 217 web_ui->AddMessageHandler(new VrShellUIMessageHandler);
220 } 218 }
221 219
222 VrShellUIUI::~VrShellUIUI() {} 220 VrShellUIUI::~VrShellUIUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698