| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Class implement the video frame recorder extension client. | 7 * Class implement the video frame recorder extension client. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 * @param {string} type Type of extension message. | 56 * @param {string} type Type of extension message. |
| 57 * @param {Object} message The parsed extension message data. | 57 * @param {Object} message The parsed extension message data. |
| 58 * @return {boolean} | 58 * @return {boolean} |
| 59 */ | 59 */ |
| 60 remoting.VideoFrameRecorder.prototype.handleMessage = | 60 remoting.VideoFrameRecorder.prototype.handleMessage = |
| 61 function(type, message) { | 61 function(type, message) { |
| 62 if (type != 'video-recorder') { | 62 if (type != 'video-recorder') { |
| 63 return false; | 63 return false; |
| 64 } | 64 } |
| 65 | 65 |
| 66 var messageType = getStringAttr(message, 'type'); | 66 var messageType = base.getStringAttr(message, 'type'); |
| 67 var messageData = getStringAttr(message, 'data'); | 67 var messageData = base.getStringAttr(message, 'data'); |
| 68 | 68 |
| 69 if (messageType == 'next-frame-reply') { | 69 if (messageType == 'next-frame-reply') { |
| 70 if (!this.fileWriter_) { | 70 if (!this.fileWriter_) { |
| 71 console.log("Received frame but have no writer"); | 71 console.log("Received frame but have no writer"); |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 if (!messageData) { | 74 if (!messageData) { |
| 75 console.log("Finished receiving frames"); | 75 console.log("Finished receiving frames"); |
| 76 this.fileWriter_ = null; | 76 this.fileWriter_ = null; |
| 77 return true; | 77 return true; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 remoting.VideoFrameRecorder.prototype.onWriteComplete_ = function(e) { | 142 remoting.VideoFrameRecorder.prototype.onWriteComplete_ = function(e) { |
| 143 console.log("Video frame write complete"); | 143 console.log("Video frame write complete"); |
| 144 this.fetchNextFrame_(); | 144 this.fetchNextFrame_(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 remoting.VideoFrameRecorder.prototype.fetchNextFrame_ = function() { | 147 remoting.VideoFrameRecorder.prototype.fetchNextFrame_ = function() { |
| 148 console.log("Request next video frame"); | 148 console.log("Request next video frame"); |
| 149 var data = { type: 'next-frame' } | 149 var data = { type: 'next-frame' } |
| 150 this.plugin_.sendClientMessage('video-recorder', JSON.stringify(data)); | 150 this.plugin_.sendClientMessage('video-recorder', JSON.stringify(data)); |
| 151 } | 151 } |
| OLD | NEW |