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

Unified Diff: chrome/browser/resources/vr_shell/vr_shell_ui.js

Issue 2550243002: Color the VR omnibox security icons. (Closed)
Patch Set: Return UI-specific image resources to the UI resource directory. Created 4 years 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/resources/vr_shell/vr_shell_ui.js
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.js b/chrome/browser/resources/vr_shell/vr_shell_ui.js
index c3595e2937d770d03ec65e46954810de33754679..cc3133ffb5aba95ee6da311fb6685d5d3447ac22 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -20,6 +20,24 @@ var vrShellUi = (function() {
return isNaN(value) ? 0 : value;
}
+ function getSecurityIcon(level) {
+ // See security_state.h and getSecurityIconResource() for this mapping.
+ let path = 'images/';
+ switch (level) {
+ case 0: // NONE
+ case 1: // HTTP_SHOW_WARNING
+ case 4: // SECURITY_WARNING
+ return path + 'info.svg';
+ case 2: // SECURE:
+ case 3: // EV_SECURE:
+ return path + 'lock.svg';
+ case 5: // SECURE_WITH_POLICY_INSTALLED_CERT (ChromeOS only)
+ case 6: // DANGEROUS
+ default:
+ return path + 'warning.svg';
+ }
+ }
+
class ContentQuad {
constructor() {
/** @const */ this.SCREEN_HEIGHT = 1.6;
@@ -347,11 +365,8 @@ var vrShellUi = (function() {
this.setNativeVisibility(false);
return;
}
- let secure = this.level == 2 || this.level == 3;
- document.querySelector('#omni-secure-icon').style.display =
- (secure ? 'block' : 'none');
- document.querySelector('#omni-insecure-icon').style.display =
- (secure ? 'none' : 'block');
+
+ document.querySelector('#omni-icon').src = getSecurityIcon(this.level);
Dan Beam 2016/12/13 03:56:59 nit: $('omni-icon').src if you're using util.js
cjgrant 2016/12/19 21:19:09 I can incorporate util.js, but we should be consis
let state = 'idle';
this.visibleAfterTransition = true;

Powered by Google App Engine
This is Rietveld 408576698