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 <string> | 7 #include <string> |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 content::WebUIDataSource* source = | 187 content::WebUIDataSource* source = |
188 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost); | 188 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost); |
189 source->UseGzip(std::unordered_set<std::string>() /* excluded_paths */); | 189 source->UseGzip(std::unordered_set<std::string>() /* excluded_paths */); |
190 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS); | 190 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS); |
191 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS); | 191 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS); |
192 source->AddResourcePath("vr_shell_ui_api.js", IDR_VR_SHELL_UI_API_JS); | 192 source->AddResourcePath("vr_shell_ui_api.js", IDR_VR_SHELL_UI_API_JS); |
193 source->AddResourcePath("vr_shell_ui_scene.js", IDR_VR_SHELL_UI_SCENE_JS); | 193 source->AddResourcePath("vr_shell_ui_scene.js", IDR_VR_SHELL_UI_SCENE_JS); |
194 source->AddResourcePath("vk.css", IDR_VR_SHELL_UI_VK_CSS); | 194 source->AddResourcePath("vk.css", IDR_VR_SHELL_UI_VK_CSS); |
195 source->AddResourcePath("vk.js", IDR_VR_SHELL_UI_VK_JS); | 195 source->AddResourcePath("vk.js", IDR_VR_SHELL_UI_VK_JS); |
196 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); | 196 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); |
197 source->AddLocalizedString( | 197 source->AddLocalizedString("insecureWebVrContentPermanent", |
198 "insecureWebVrContentPermanent", | 198 IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_PERMANENT); |
199 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT); | 199 source->AddLocalizedString("insecureWebVrContentTransient", |
200 source->AddLocalizedString( | 200 IDS_PAGE_INFO_INSECURE_WEBVR_CONTENT_TRANSIENT); |
201 "insecureWebVrContentTransient", | |
202 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT); | |
203 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON); | 201 source->AddLocalizedString("back", IDS_VR_SHELL_UI_BACK_BUTTON); |
204 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON); | 202 source->AddLocalizedString("forward", IDS_VR_SHELL_UI_FORWARD_BUTTON); |
205 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON); | 203 source->AddLocalizedString("reload", IDS_VR_SHELL_UI_RELOAD_BUTTON); |
206 source->AddLocalizedString("newTab", IDS_VR_SHELL_NEW_TAB_BUTTON); | 204 source->AddLocalizedString("newTab", IDS_VR_SHELL_NEW_TAB_BUTTON); |
207 source->AddLocalizedString("newIncognitoTab", | 205 source->AddLocalizedString("newIncognitoTab", |
208 IDS_VR_SHELL_NEW_INCOGNITO_TAB_BUTTON); | 206 IDS_VR_SHELL_NEW_INCOGNITO_TAB_BUTTON); |
209 | 207 |
210 return source; | 208 return source; |
211 } | 209 } |
212 #endif | 210 #endif |
213 | 211 |
214 } // namespace | 212 } // namespace |
215 | 213 |
216 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 214 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
217 Profile* profile = Profile::FromWebUI(web_ui); | 215 Profile* profile = Profile::FromWebUI(web_ui); |
218 #if !defined(ENABLE_VR_SHELL_UI_DEV) | 216 #if !defined(ENABLE_VR_SHELL_UI_DEV) |
219 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); | 217 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); |
220 #else | 218 #else |
221 content::URLDataSource::Add( | 219 content::URLDataSource::Add( |
222 profile, new RemoteDataSource(profile->GetRequestContext())); | 220 profile, new RemoteDataSource(profile->GetRequestContext())); |
223 #endif | 221 #endif |
224 web_ui->AddMessageHandler(base::MakeUnique<VrShellUIMessageHandler>()); | 222 web_ui->AddMessageHandler(base::MakeUnique<VrShellUIMessageHandler>()); |
225 } | 223 } |
226 | 224 |
227 VrShellUIUI::~VrShellUIUI() {} | 225 VrShellUIUI::~VrShellUIUI() {} |
OLD | NEW |