| Index: chrome/browser/resources/video_player/js/background.js
|
| diff --git a/chrome/browser/resources/video_player/js/background.js b/chrome/browser/resources/video_player/js/background.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0ec6bdaaea6e84f133a63ea64d8ecd6c1226c6d7
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/video_player/js/background.js
|
| @@ -0,0 +1,33 @@
|
| +// 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';
|
| +
|
| +chrome.app.runtime.onLaunched.addListener(function(launchData) {
|
| + if (!launchData || !launchData.items || launchData.items.length == 0)
|
| + return;
|
| +
|
| + var entry = launchData.items[0].entry;
|
| + entry.file(function(file) {
|
| + var url = window.URL.createObjectURL(file);
|
| + open(url, entry.name);
|
| + }, function() {
|
| + // TODO(yoshiki): handle error in a smarter way.
|
| + open('', 'error'); // Empty URL shows the error message.
|
| + });
|
| +});
|
| +
|
| +function open(url, title) {
|
| + chrome.app.window.create('video_player.html', {
|
| + id: 'video',
|
| + singleton: false,
|
| + minWidth: 160,
|
| + minHeight: 100
|
| + },
|
| + function(createdWindow) {
|
| + createdWindow.setIcon('images/200/icon.png');
|
| + createdWindow.contentWindow.videoUrl = url;
|
| + createdWindow.contentWindow.videoTitle = title;
|
| + });
|
| +}
|
|
|