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

Unified Diff: chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc

Issue 2363553003: VrShell: implement insecure content warning display (Closed)
Patch Set: dbeam #58/#59: CSS fixes, move icon to separate resource file 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc
diff --git a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc
index 1ce55c9c4ef29e9e10bb8e12b10789c466ae393a..6e3f4b7d55bb490ada78d5db1fd7fb75f1fa3598 100644
--- a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc
+++ b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc
@@ -10,8 +10,12 @@
#include "content/public/browser/web_ui.h"
#if !defined(ENABLE_VR_SHELL_UI_DEV)
+#include "chrome/browser/browser_process.h"
#include "chrome/grit/browser_resources.h"
+#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/webui/web_ui_util.h"
#else
#include <map>
#include "base/macros.h"
@@ -179,7 +183,26 @@ content::WebUIDataSource* CreateVrShellUIHTMLSource() {
source->AddResourcePath("vr_shell_ui.js", IDR_VR_SHELL_UI_JS);
source->AddResourcePath("vr_shell_ui.css", IDR_VR_SHELL_UI_CSS);
source->SetDefaultResource(IDR_VR_SHELL_UI_HTML);
- source->DisableI18nAndUseGzipForAllPaths();
+ // We're localizing strings, so we can't currently use gzip since it's
+ // incompatible with i18n. TODO(klausw): re-enable gzip once an i18n
+ // compatible variant of WebUIDataSource's DisableI18nAndUseGzipForAllPaths
+ // gets added, and add compress=gzip to browser_resources.grd as appropriate.
+
+ base::DictionaryValue localized_strings;
+
+ localized_strings.SetString(
+ "insecureWebVrContentPermanent",
+ l10n_util::GetStringUTF16(
+ IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT));
+ localized_strings.SetString(
+ "insecureWebVrContentTransient",
+ l10n_util::GetStringUTF16(
+ IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_TRANSIENT));
+
+ const std::string& app_locale = g_browser_process->GetApplicationLocale();
+ webui::SetLoadTimeDataDefaults(app_locale, &localized_strings);
Dan Beam 2016/10/03 20:30:59 why are you adding this? SetLoadTimeDataDefaults(
klausw 2016/10/03 21:28:19 Thank you, it does indeed work without it. FWIW, t
+
+ source->AddLocalizedStrings(localized_strings);
return source;
}
#endif

Powered by Google App Engine
This is Rietveld 408576698