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

Unified Diff: ui/file_manager/gallery/js/background.js

Issue 246543002: Add script files of the separated Gallery.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/gallery/gallery.html ('k') | ui/file_manager/gallery/js/gallery.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/background.js
diff --git a/ui/file_manager/gallery/js/background.js b/ui/file_manager/gallery/js/background.js
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..96a86daa4154eec4478d0acd8d6dd790136b0b82 100644
--- a/ui/file_manager/gallery/js/background.js
+++ b/ui/file_manager/gallery/js/background.js
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+'use strict';
+
+var stringData = new Promise(function(fulfill) {
+ chrome.fileBrowserPrivate.getStrings(function(stringData) {
+ loadTimeData.data = stringData;
+ fulfill(stringData);
+ });
+});
+
+// VolumeManager should be obtained after stringData initialized.
+var volumeManager = stringData.then(function() {
+ return new Promise(function(fulfill) {
+ VolumeManager.getInstance(fulfill);
+ });
+});
+
+var backgroundComponent = Promise.all([stringData, volumeManager]).
+ then(function(args) {
+ return {
+ stringData: args[0],
+ volumeManager: args[1]
+ };
+ });
+
+chrome.app.runtime.onLaunched.addListener(function(launchData) {
+ // Skip if files are not selected.
+ if (!launchData || !launchData.items || launchData.items.length == 0)
+ return;
+
+ // Open application window.
+ chrome.app.window.create(
+ 'gallery.html',
+ {
+ id: 'video',
+ minWidth: 160,
+ minHeight: 100,
+ frame: 'none'
+ },
+ function(appWindow) {
+ appWindow.contentWindow.launchData = launchData;
+ appWindow.contentWindow.backgroundComponent = backgroundComponent;
+ });
+});
« no previous file with comments | « ui/file_manager/gallery/gallery.html ('k') | ui/file_manager/gallery/js/gallery.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698