OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 'use strict'; |
| 6 |
| 7 chrome.app.runtime.onLaunched.addListener(function(launchData) { |
| 8 if (!launchData || !launchData.items || launchData.items.length == 0) |
| 9 return; |
| 10 |
| 11 var entry = launchData.items[0].entry; |
| 12 entry.file(function(file) { |
| 13 var url = window.URL.createObjectURL(file); |
| 14 open(url, entry.name); |
| 15 }, function() { |
| 16 // TODO(yoshiki): handle error in a smarter way. |
| 17 open('', 'error'); // Empty URL shows the error message. |
| 18 }); |
| 19 }); |
| 20 |
| 21 function open(url, title) { |
| 22 chrome.app.window.create('video_player.html', { |
| 23 id: 'video', |
| 24 singleton: false, |
| 25 minWidth: 160, |
| 26 minHeight: 100 |
| 27 }, |
| 28 function(createdWindow) { |
| 29 createdWindow.setIcon('images/200/icon.png'); |
| 30 createdWindow.contentWindow.videoUrl = url; |
| 31 createdWindow.contentWindow.videoTitle = title; |
| 32 }); |
| 33 } |
OLD | NEW |