OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Namespace for the share dialog mock. | 5 // Namespace for the share dialog mock. |
6 var shareDialog = {}; | 6 var shareDialog = {}; |
7 | 7 |
8 /** | 8 /** |
9 * Origin of Files.app. | 9 * Origin of Files.app. |
10 * @type {string} | 10 * @type {string} |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 * done. | 86 * done. |
87 * @private | 87 * @private |
88 */ | 88 */ |
89 shareDialog.onResizeComplete_ = function() { | 89 shareDialog.onResizeComplete_ = function() { |
90 var container = document.querySelector('#container'); | 90 var container = document.querySelector('#container'); |
91 container.style.width = shareDialog.TARGET_WIDTH + 'px'; | 91 container.style.width = shareDialog.TARGET_WIDTH + 'px'; |
92 container.style.height = shareDialog.TARGET_HEIGHT + 'px'; | 92 container.style.height = shareDialog.TARGET_HEIGHT + 'px'; |
93 }; | 93 }; |
94 | 94 |
95 /** | 95 /** |
| 96 * Changes the visibility of the dialog. |
| 97 * @param {boolean} visible True to set the dialog visible, false to set it |
| 98 * invisible. |
| 99 */ |
| 100 shareDialog.setVisible = function(visible) { |
| 101 shareDialog.sendMessage_('setVisible', {visible: visible}); |
| 102 }; |
| 103 |
| 104 /** |
96 * Prepares the embedder to make the contents visible. | 105 * Prepares the embedder to make the contents visible. |
97 */ | 106 */ |
98 shareDialog.prepareForVisible = function() { | 107 shareDialog.prepareForVisible = function() { |
99 shareDialog.sendMessage_('prepareForVisible'); | 108 shareDialog.sendMessage_('prepareForVisible'); |
100 }; | 109 }; |
101 | 110 |
102 /** | 111 /** |
103 * Resizes the embedder to the content window dimensions. | 112 * Resizes the embedder to the content window dimensions. |
104 */ | 113 */ |
105 shareDialog.resize = function() { | 114 shareDialog.resize = function() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 155 |
147 /** | 156 /** |
148 * Initializes the mocked share dialog. | 157 * Initializes the mocked share dialog. |
149 */ | 158 */ |
150 shareDialog.initialize = function() { | 159 shareDialog.initialize = function() { |
151 window.addEventListener('message', shareDialog.onMessage_); | 160 window.addEventListener('message', shareDialog.onMessage_); |
152 shareDialog.prepareForVisible(); | 161 shareDialog.prepareForVisible(); |
153 }; | 162 }; |
154 | 163 |
155 window.addEventListener('load', shareDialog.initialize); | 164 window.addEventListener('load', shareDialog.initialize); |
OLD | NEW |