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

Unified Diff: chrome/browser/resources/video_player/js/background.js

Issue 196383030: [VideoPlayer] dedicated video player app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add the script file to the whitelist. Created 6 years, 9 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
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;
+ });
+}
« no previous file with comments | « chrome/browser/resources/video_player/images/200/icon.png ('k') | chrome/browser/resources/video_player/js/video_player.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698