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

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

Issue 2363553003: VrShell: implement insecure content warning display (Closed)
Patch Set: Try to mark dependent CL Created 4 years, 2 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
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"
11 11
12 #if !defined(ENABLE_VR_SHELL_UI_DEV) 12 #if !defined(ENABLE_VR_SHELL_UI_DEV)
13 #include "chrome/grit/browser_resources.h" 13 #include "chrome/grit/browser_resources.h"
14 #include "chrome/grit/generated_resources.h"
14 #include "content/public/browser/web_ui_data_source.h" 15 #include "content/public/browser/web_ui_data_source.h"
15 #else 16 #else
16 #include <map> 17 #include <map>
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/ref_counted_memory.h" 19 #include "base/memory/ref_counted_memory.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "content/public/browser/url_data_source.h" 21 #include "content/public/browser/url_data_source.h"
21 #include "net/url_request/url_fetcher.h" 22 #include "net/url_request/url_fetcher.h"
22 #include "net/url_request/url_fetcher_delegate.h" 23 #include "net/url_request/url_fetcher_delegate.h"
23 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 delete source; 173 delete source;
173 pending_.erase(it); 174 pending_.erase(it);
174 } 175 }
175 #else 176 #else
176 content::WebUIDataSource* CreateVrShellUIHTMLSource() { 177 content::WebUIDataSource* CreateVrShellUIHTMLSource() {
177 content::WebUIDataSource* source = 178 content::WebUIDataSource* source =
178 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost); 179 content::WebUIDataSource::Create(chrome::kChromeUIVrShellUIHost);
179 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS); 180 source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS);
180 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS); 181 source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS);
181 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); 182 source->SetDefaultResource(IDR_VR_SHELL_UI_HTML);
182 source->DisableI18nAndUseGzipForAllPaths(); 183 // We're localizing strings, so we can't use gzip since it's
184 // currently incompatible with i18n. See WebUIDataSource's
185 // DisableI18nAndUseGzipForAllPaths() comments.
Dan Beam 2016/09/27 20:28:43 yeah, i'll fix this eventually
186 source->AddLocalizedString(
187 "insecureWebVrContentPermanent",
188 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT);
189 source->AddLocalizedString(
190 "insecureWebVrContentTransient",
191 IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT);
183 return source; 192 return source;
184 } 193 }
185 #endif 194 #endif
186 195
187 } // namespace 196 } // namespace
188 197
189 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) { 198 VrShellUIUI::VrShellUIUI(content::WebUI* web_ui) : WebUIController(web_ui) {
190 Profile* profile = Profile::FromWebUI(web_ui); 199 Profile* profile = Profile::FromWebUI(web_ui);
191 #if !defined(ENABLE_VR_SHELL_UI_DEV) 200 #if !defined(ENABLE_VR_SHELL_UI_DEV)
192 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource()); 201 content::WebUIDataSource::Add(profile, CreateVrShellUIHTMLSource());
193 #else 202 #else
194 content::URLDataSource::Add( 203 content::URLDataSource::Add(
195 profile, new RemoteDataSource(profile->GetRequestContext())); 204 profile, new RemoteDataSource(profile->GetRequestContext()));
196 #endif 205 #endif
197 web_ui->AddMessageHandler(new VrShellUIMessageHandler); 206 web_ui->AddMessageHandler(new VrShellUIMessageHandler);
198 } 207 }
199 208
200 VrShellUIUI::~VrShellUIUI() {} 209 VrShellUIUI::~VrShellUIUI() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698