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

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: Address comment 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 source->UseGzip(std::unordered_set<std::string>() /* excluded_paths */);
186 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS); 187 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS);
187 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS); 188 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); 189 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); 190 source->AddResourcePath("vr_shell_ui_scene.js", IDR_VR_SHELL_UI_SCENE_JS);
190 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); 191 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( 192 source->AddLocalizedString(
196 "insecureWebVrContentPermanent", 193 "insecureWebVrContentPermanent",
197 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT); 194 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT);
198 source->AddLocalizedString( 195 source->AddLocalizedString(
199 "insecureWebVrContentTransient", 196 "insecureWebVrContentTransient",
200 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT); 197 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT);
201 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON); 198 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON);
202 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON); 199 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON);
203 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON); 200 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON);
204 201
205 return source; 202 return source;
206 } 203 }
207 #endif 204 #endif
208 205
209 } // namespace 206 } // namespace
210 207
211 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) { 208 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) {
212 Profile* profile = Profile::FromWebUI(web_ui); 209 Profile* profile = Profile::FromWebUI(web_ui);
213 #if !defined(ENABLE_VR_SHELL_UI_DEV) 210 #if !defined(ENABLE_VR_SHELL_UI_DEV)
214 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); 211 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource());
215 #else 212 #else
216 content::URLDataSource::Add( 213 content::URLDataSource::Add(
217 profile, new RemoteDataSource(profile->GetRequestContext())); 214 profile, new RemoteDataSource(profile->GetRequestContext()));
218 #endif 215 #endif
219 web_ui->AddMessageHandler(new VrShellUIMessageHandler); 216 web_ui->AddMessageHandler(new VrShellUIMessageHandler);
220 } 217 }
221 218
222 VrShellUIUI::~VrShellUIUI() {} 219 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