OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Map of all currently open app window. The key is an app id. | 8 * Map of all currently open app window. The key is an app id. |
9 */ | 9 */ |
10 var appWindows = {}; | 10 var appWindows = {}; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // Show after changing bounds is done. For the new UI, Files.app shows | 133 // Show after changing bounds is done. For the new UI, Files.app shows |
134 // it's window as soon as the UI is pre-initialized. | 134 // it's window as soon as the UI is pre-initialized. |
135 if (!this.id_.match(FILES_ID_PATTERN)) | 135 if (!this.id_.match(FILES_ID_PATTERN)) |
136 appWindow.show(); | 136 appWindow.show(); |
137 | 137 |
138 appWindows[this.id_] = appWindow; | 138 appWindows[this.id_] = appWindow; |
139 var contentWindow = appWindow.contentWindow; | 139 var contentWindow = appWindow.contentWindow; |
140 contentWindow.appID = this.id_; | 140 contentWindow.appID = this.id_; |
141 contentWindow.appState = this.appState_; | 141 contentWindow.appState = this.appState_; |
142 contentWindow.appInitialURL = this.url_; | 142 contentWindow.appInitialURL = this.url_; |
| 143 if (window.IN_TEST) |
| 144 contentWindow.IN_TEST = true; |
143 appWindow.onClosed.addListener(function() { | 145 appWindow.onClosed.addListener(function() { |
144 if (contentWindow.unload) | 146 if (contentWindow.unload) |
145 contentWindow.unload(); | 147 contentWindow.unload(); |
146 if (contentWindow.saveOnExit) { | 148 if (contentWindow.saveOnExit) { |
147 contentWindow.saveOnExit.forEach(function(entry) { | 149 contentWindow.saveOnExit.forEach(function(entry) { |
148 util.AppCache.update(entry.key, entry.value); | 150 util.AppCache.update(entry.key, entry.value); |
149 }); | 151 }); |
150 } | 152 } |
151 delete appWindows[this.id_]; | 153 delete appWindows[this.id_]; |
152 chrome.storage.local.remove(this.id_); // Forget the persisted state. | 154 chrome.storage.local.remove(this.id_); // Forget the persisted state. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 queue.run(function(callback) { | 570 queue.run(function(callback) { |
569 chrome.fileBrowserPrivate.getStrings(function(strings) { | 571 chrome.fileBrowserPrivate.getStrings(function(strings) { |
570 initContextMenu(strings); | 572 initContextMenu(strings); |
571 chrome.storage.local.set({strings: strings}, callback); | 573 chrome.storage.local.set({strings: strings}, callback); |
572 }); | 574 }); |
573 }); | 575 }); |
574 } | 576 } |
575 | 577 |
576 // Initialize Files.app. | 578 // Initialize Files.app. |
577 initApp(); | 579 initApp(); |
OLD | NEW |