| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 function MockEventSource() { | 5 function MockEventSource() { |
| 6 this.listeners_ = []; | 6 this.listeners_ = []; |
| 7 } | 7 } |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Add a listener. | 10 * Add a listener. |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } else { | 376 } else { |
| 377 metadata.deviceType = 'file'; | 377 metadata.deviceType = 'file'; |
| 378 } | 378 } |
| 379 callback(metadata); | 379 callback(metadata); |
| 380 }, | 380 }, |
| 381 | 381 |
| 382 onDocumentFeedFetched: new MockEventSource(), | 382 onDocumentFeedFetched: new MockEventSource(), |
| 383 | 383 |
| 384 pinned_: {}, | 384 pinned_: {}, |
| 385 | 385 |
| 386 getGDataFileProperties: function(urls, callback) { | 386 getDriveFileProperties: function(urls, callback) { |
| 387 var response = []; | 387 var response = []; |
| 388 for (var i = 0; i != urls.length; i++) { | 388 for (var i = 0; i != urls.length; i++) { |
| 389 var url = urls[i]; | 389 var url = urls[i]; |
| 390 response.push({ | 390 response.push({ |
| 391 fileUrl: url, | 391 fileUrl: url, |
| 392 isHosted: url.match(/\.g(doc|slides|sheet|draw|table)$/i), | 392 isHosted: url.match(/\.g(doc|slides|sheet|draw|table)$/i), |
| 393 isPinned: (url in chrome.fileBrowserPrivate.pinned_) | 393 isPinned: (url in chrome.fileBrowserPrivate.pinned_) |
| 394 }); | 394 }); |
| 395 } | 395 } |
| 396 setTimeout(callback, 0, response); | 396 setTimeout(callback, 0, response); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 426 getNetworkConnectionState: function(callback) { | 426 getNetworkConnectionState: function(callback) { |
| 427 setTimeout(callback, 0, cloneShallow( | 427 setTimeout(callback, 0, cloneShallow( |
| 428 chrome.fileBrowserPrivate.networkConnectionState_)); | 428 chrome.fileBrowserPrivate.networkConnectionState_)); |
| 429 }, | 429 }, |
| 430 | 430 |
| 431 setConnectionState_: function(state) { | 431 setConnectionState_: function(state) { |
| 432 chrome.fileBrowserPrivate.networkConnectionState_ = state; | 432 chrome.fileBrowserPrivate.networkConnectionState_ = state; |
| 433 chrome.fileBrowserPrivate.onNetworkConnectionChanged.notify(); | 433 chrome.fileBrowserPrivate.onNetworkConnectionChanged.notify(); |
| 434 }, | 434 }, |
| 435 | 435 |
| 436 pinGDataFile: function(urls, on, callback) { | 436 pinDriveFile: function(urls, on, callback) { |
| 437 for (var i = 0; i != urls.length; i++) { | 437 for (var i = 0; i != urls.length; i++) { |
| 438 var url = urls[i]; | 438 var url = urls[i]; |
| 439 if (on) { | 439 if (on) { |
| 440 chrome.fileBrowserPrivate.pinned_[url] = true; | 440 chrome.fileBrowserPrivate.pinned_[url] = true; |
| 441 } else { | 441 } else { |
| 442 delete chrome.fileBrowserPrivate.pinned_[url]; | 442 delete chrome.fileBrowserPrivate.pinned_[url]; |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 chrome.fileBrowserPrivate.getGDataFileProperties(urls, callback); | 445 chrome.fileBrowserPrivate.getDriveFileProperties(urls, callback); |
| 446 }, | 446 }, |
| 447 | 447 |
| 448 toggleFullscreen: function() { | 448 toggleFullscreen: function() { |
| 449 if (document.webkitIsFullScreen) | 449 if (document.webkitIsFullScreen) |
| 450 document.webkitCancelFullScreen(); | 450 document.webkitCancelFullScreen(); |
| 451 else | 451 else |
| 452 document.body.webkitRequestFullScreen(); | 452 document.body.webkitRequestFullScreen(); |
| 453 }, | 453 }, |
| 454 | 454 |
| 455 isFullscreen: function(callback) { | 455 isFullscreen: function(callback) { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 playAudio: function(urls, position) { | 873 playAudio: function(urls, position) { |
| 874 this.audioPlaylist_ = { items: urls, position: position }; | 874 this.audioPlaylist_ = { items: urls, position: position }; |
| 875 this.onPlaylistChanged.notify(); | 875 this.onPlaylistChanged.notify(); |
| 876 }, | 876 }, |
| 877 | 877 |
| 878 playVideo: function(url) { | 878 playVideo: function(url) { |
| 879 this.videoUrl_ = url; | 879 this.videoUrl_ = url; |
| 880 this.onVideoLaunched.notify(); | 880 this.onVideoLaunched.notify(); |
| 881 } | 881 } |
| 882 }; | 882 }; |
| OLD | NEW |