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

Side by Side Diff: chrome/browser/resources/vr_shell/vr_shell_ui.js

Issue 2363553003: VrShell: implement insecure content warning display (Closed)
Patch Set: Josh: lower permanent icon by half its height. 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 var vrShellUi = (function() { 5 var vrShellUi = (function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Enumeration of valid Anchroing for X axis. 9 * Enumeration of valid Anchroing for X axis.
10 * A mesh can either be anchored to the left, right, or center of the main 10 * A mesh can either be anchored to the left, right, or center of the main
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ]; 176 ];
177 177
178 var buttonWidth = 0.3; 178 var buttonWidth = 0.3;
179 var buttonHeight = 0.2; 179 var buttonHeight = 0.2;
180 var buttonSpacing = 0.5; 180 var buttonSpacing = 0.5;
181 var buttonStartPosition = -buttonSpacing * (buttons.length / 2.0 - 0.5); 181 var buttonStartPosition = -buttonSpacing * (buttons.length / 2.0 - 0.5);
182 182
183 for (var i = 0; i < buttons.length; i++) { 183 for (var i = 0; i < buttons.length; i++) {
184 var b = document.createElement('div'); 184 var b = document.createElement('div');
185 b.position = 'absolute'; 185 b.position = 'absolute';
186 b.style.top = '200px'; 186 b.style.top = '384px';
187 b.style.left = 50 * i + 'px'; 187 b.style.left = 50 * i + 'px';
188 b.style.width = '50px'; 188 b.style.width = '50px';
189 b.style.height = '50px'; 189 b.style.height = '50px';
190 b.className = 'ui-button'; 190 b.className = 'ui-button';
191 b.textContent = buttons[i][0]; 191 b.textContent = buttons[i][0];
192 192
193 // Add click behaviour. 193 // Add click behaviour.
194 b.addEventListener('click', function(action, e) { 194 b.addEventListener('click', function(action, e) {
195 chrome.send('doAction', [action]); 195 chrome.send('doAction', [action]);
196 }.bind(undefined, buttons[i][1])); 196 }.bind(undefined, buttons[i][1]));
197 197
198 document.body.appendChild(b); 198 document.body.appendChild(b);
199 199
200 // Add a UI rectangle for the button. 200 // Add a UI rectangle for the button.
201 var el = new UiElement(50 * i, 200, 50, 50, buttonWidth, buttonHeight); 201 var el = new UiElement(50 * i, 384, 50, 50, buttonWidth, buttonHeight);
202 el.parentId = 0; 202 el.parentId = 0;
203 el.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM); 203 el.setAnchoring(XAnchoring.XNONE, YAnchoring.YBOTTOM);
204 el.setTranslation(buttonStartPosition + buttonSpacing * i, -0.3, 0.0); 204 el.setTranslation(buttonStartPosition + buttonSpacing * i, -0.3, 0.0);
205 var id = idIndex++; 205 var id = idIndex++;
206 addMesh(id, el); 206 addMesh(id, el);
207 207
208 // Add transitions when the mouse hovers over (and leaves) the button. 208 // Add transitions when the mouse hovers over (and leaves) the button.
209 b.addEventListener('mouseenter', function(buttonId, width, height, e) { 209 b.addEventListener('mouseenter', function(buttonId, width, height, e) {
210 var resize = new Animation(buttonId, 250); 210 var resize = new Animation(buttonId, 250);
211 resize.id = idIndex++; 211 resize.id = idIndex++;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 250 }
251 chrome.send('updateScene', commands); 251 chrome.send('updateScene', commands);
252 } 252 }
253 253
254 return { 254 return {
255 initialize: initialize, 255 initialize: initialize,
256 }; 256 };
257 })(); 257 })();
258 258
259 document.addEventListener('DOMContentLoaded', vrShellUi.initialize); 259 document.addEventListener('DOMContentLoaded', vrShellUi.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698