| OLD | NEW |
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS); | 186 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS); |
| 187 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS); | 187 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); | 188 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); | 189 source->AddResourcePath("vr_shell_ui_scene.js", IDR_VR_SHELL_UI_SCENE_JS); |
| 190 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); | 190 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); |
| 191 // We're localizing strings, so we can't currently use gzip since it's | 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 | 192 // incompatible with i18n. TODO(klausw): re-enable gzip once an i18n |
| 193 // compatible variant of WebUIDataSource's DisableI18nAndUseGzipForAllPaths | 193 // compatible variant of WebUIDataSource's UseGzipForAllPaths |
| 194 // gets added, and add compress=gzip to browser_resources.grd as appropriate. | 194 // gets added, and add compress=gzip to browser_resources.grd as appropriate. |
| 195 source->AddLocalizedString( | 195 source->AddLocalizedString( |
| 196 "insecureWebVrContentPermanent", | 196 "insecureWebVrContentPermanent", |
| 197 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT); | 197 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT); |
| 198 source->AddLocalizedString( | 198 source->AddLocalizedString( |
| 199 "insecureWebVrContentTransient", | 199 "insecureWebVrContentTransient", |
| 200 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT); | 200 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT); |
| 201 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON); | 201 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON); |
| 202 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON); | 202 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON); |
| 203 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON); | 203 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON); |
| 204 | 204 |
| 205 return source; | 205 return source; |
| 206 } | 206 } |
| 207 #endif | 207 #endif |
| 208 | 208 |
| 209 } // namespace | 209 } // namespace |
| 210 | 210 |
| 211 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 211 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 212 Profile* profile = Profile::FromWebUI(web_ui); | 212 Profile* profile = Profile::FromWebUI(web_ui); |
| 213 #if !defined(ENABLE_VR_SHELL_UI_DEV) | 213 #if !defined(ENABLE_VR_SHELL_UI_DEV) |
| 214 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); | 214 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); |
| 215 #else | 215 #else |
| 216 content::URLDataSource::Add( | 216 content::URLDataSource::Add( |
| 217 profile, new RemoteDataSource(profile->GetRequestContext())); | 217 profile, new RemoteDataSource(profile->GetRequestContext())); |
| 218 #endif | 218 #endif |
| 219 web_ui->AddMessageHandler(new VrShellUIMessageHandler); | 219 web_ui->AddMessageHandler(new VrShellUIMessageHandler); |
| 220 } | 220 } |
| 221 | 221 |
| 222 VrShellUIUI::~VrShellUIUI() {} | 222 VrShellUIUI::~VrShellUIUI() {} |
| OLD | NEW |