| 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" |
| 11 | 11 |
| 12 #if !defined(ENABLE_VR_SHELL_UI_DEV) | 12 #if !defined(ENABLE_VR_SHELL_UI_DEV) |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/grit/browser_resources.h" | 14 #include "chrome/grit/browser_resources.h" |
| 15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 16 #include "content/public/browser/web_ui_data_source.h" | 16 #include "content/public/browser/web_ui_data_source.h" |
| 17 #include "ui/resources/grit/webui_resources.h" |
| 17 #else | 18 #else |
| 18 #include <map> | 19 #include <map> |
| 19 #include "base/macros.h" | 20 #include "base/macros.h" |
| 20 #include "base/memory/ref_counted_memory.h" | 21 #include "base/memory/ref_counted_memory.h" |
| 21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 22 #include "content/public/browser/url_data_source.h" | 23 #include "content/public/browser/url_data_source.h" |
| 23 #include "net/url_request/url_fetcher.h" | 24 #include "net/url_request/url_fetcher.h" |
| 24 #include "net/url_request/url_fetcher_delegate.h" | 25 #include "net/url_request/url_fetcher_delegate.h" |
| 25 #include "net/url_request/url_request_context_getter.h" | 26 #include "net/url_request/url_request_context_getter.h" |
| 26 #endif | 27 #endif |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 pending_.erase(it); | 181 pending_.erase(it); |
| 181 } | 182 } |
| 182 #else | 183 #else |
| 183 content::WebUIDataSource* CreateVrShellUIHTMLSource() { | 184 content::WebUIDataSource* CreateVrShellUIHTMLSource() { |
| 184 content::WebUIDataSource* source = | 185 content::WebUIDataSource* source = |
| 185 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost); | 186 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost); |
| 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); |
| 191 source->AddResourcePath("images/info.svg", IDR_VR_SHELL_UI_IMAGE_INFO); |
| 192 source->AddResourcePath("images/lock.svg", IDR_VR_SHELL_UI_IMAGE_LOCK); |
| 193 source->AddResourcePath("images/warning.svg", IDR_VR_SHELL_UI_IMAGE_WARNING); |
| 194 source->AddResourcePath("images/back.svg", IDR_VR_SHELL_UI_IMAGE_BACK); |
| 195 source->AddResourcePath("images/reload.svg", IDR_VR_SHELL_UI_IMAGE_RELOAD); |
| 190 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); | 196 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); |
| 191 // We're localizing strings, so we can't currently use gzip since it's | 197 // 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 | 198 // incompatible with i18n. TODO(klausw): re-enable gzip once an i18n |
| 193 // compatible variant of WebUIDataSource's DisableI18nAndUseGzipForAllPaths | 199 // compatible variant of WebUIDataSource's DisableI18nAndUseGzipForAllPaths |
| 194 // gets added, and add compress=gzip to browser_resources.grd as appropriate. | 200 // gets added, and add compress=gzip to browser_resources.grd as appropriate. |
| 195 source->AddLocalizedString( | 201 source->AddLocalizedString( |
| 196 "insecureWebVrContentPermanent", | 202 "insecureWebVrContentPermanent", |
| 197 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT); | 203 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT); |
| 198 source->AddLocalizedString( | 204 source->AddLocalizedString( |
| 199 "insecureWebVrContentTransient", | 205 "insecureWebVrContentTransient", |
| (...skipping 13 matching lines...) Expand all Loading... |
| 213 #if !defined(ENABLE_VR_SHELL_UI_DEV) | 219 #if !defined(ENABLE_VR_SHELL_UI_DEV) |
| 214 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); | 220 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); |
| 215 #else | 221 #else |
| 216 content::URLDataSource::Add( | 222 content::URLDataSource::Add( |
| 217 profile, new RemoteDataSource(profile->GetRequestContext())); | 223 profile, new RemoteDataSource(profile->GetRequestContext())); |
| 218 #endif | 224 #endif |
| 219 web_ui->AddMessageHandler(new VrShellUIMessageHandler); | 225 web_ui->AddMessageHandler(new VrShellUIMessageHandler); |
| 220 } | 226 } |
| 221 | 227 |
| 222 VrShellUIUI::~VrShellUIUI() {} | 228 VrShellUIUI::~VrShellUIUI() {} |
| OLD | NEW |