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 var vrShellUi = (function() { | 5 var vrShellUi = (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 let ui = new scene.Scene(); | 8 let ui = new scene.Scene(); |
9 let uiManager; | 9 let uiManager; |
10 let nativeCommandHandler; | 10 let nativeCommandHandler; |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 | 719 |
720 getQualifiedTabId(tab) { | 720 getQualifiedTabId(tab) { |
721 return (tab.incognito ? 'i' : 'n') + tab.id; | 721 return (tab.incognito ? 'i' : 'n') + tab.id; |
722 } | 722 } |
723 | 723 |
724 makeDomTab(tab) { | 724 makeDomTab(tab) { |
725 // Make a copy of the template tab and add this copy to the tab container | 725 // Make a copy of the template tab and add this copy to the tab container |
726 // view. | 726 // view. |
727 let domTab = this.domTabTemplate.cloneNode(true); | 727 let domTab = this.domTabTemplate.cloneNode(true); |
728 domTab.removeAttribute('id'); | 728 domTab.removeAttribute('id'); |
| 729 domTab.addEventListener('click', function() { |
| 730 api.doAction(api.Action.SHOW_TAB, {'id': domTab.tab.id}); |
| 731 }); |
| 732 domTab.tab = tab; |
729 this.domTabClip.appendChild(domTab); | 733 this.domTabClip.appendChild(domTab); |
730 this.domTabs[this.getQualifiedTabId(tab)] = domTab; | 734 this.domTabs[this.getQualifiedTabId(tab)] = domTab; |
731 return domTab; | 735 return domTab; |
732 } | 736 } |
733 | 737 |
734 resizeClipElement() { | 738 resizeClipElement() { |
735 // Resize clip element so that scrolling works. | 739 // Resize clip element so that scrolling works. |
736 this.domTabClip.style.width = | 740 this.domTabClip.style.width = |
737 (Object.keys(this.tabs).length * this.domTabWidth) + 'px'; | 741 (Object.keys(this.tabs).length * this.domTabWidth) + 'px'; |
738 } | 742 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 nativeCommandHandler.handleCommand(dict); | 956 nativeCommandHandler.handleCommand(dict); |
953 } | 957 } |
954 | 958 |
955 return { | 959 return { |
956 initialize: initialize, | 960 initialize: initialize, |
957 command: command, | 961 command: command, |
958 }; | 962 }; |
959 })(); | 963 })(); |
960 | 964 |
961 window.addEventListener('load', vrShellUi.initialize); | 965 window.addEventListener('load', vrShellUi.initialize); |
OLD | NEW |