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

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

Issue 182733009: [AudioPlayer] Don't start a playback automatically when reopening (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/resources/file_manager/audio_player/js/audio_player.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/background/js/background.js
diff --git a/chrome/browser/resources/file_manager/background/js/background.js b/chrome/browser/resources/file_manager/background/js/background.js
index b17c5a78ace59ac733fb8daa57bdecdf3f7e0b3b..773fa2be4fb93dfb994738782b31ff4176d8c4a6 100644
--- a/chrome/browser/resources/file_manager/background/js/background.js
+++ b/chrome/browser/resources/file_manager/background/js/background.js
@@ -294,9 +294,11 @@ AppWindowWrapper.prototype.setIcon = function(iconPath) {
* Opens the window.
*
* @param {Object} appState App state.
+ * @param {boolean} reopen True if the launching is triggered automatically.
+ * False otherwize.
* @param {function()=} opt_callback Completion callback.
*/
-AppWindowWrapper.prototype.launch = function(appState, opt_callback) {
+AppWindowWrapper.prototype.launch = function(appState, reopen, opt_callback) {
// Check if the window is opened or not.
if (this.openingOrOpened_) {
console.error('The window is already opened.');
@@ -392,6 +394,7 @@ AppWindowWrapper.prototype.launch = function(appState, opt_callback) {
var contentWindow = appWindow.contentWindow;
contentWindow.appID = this.id_;
contentWindow.appState = this.appState_;
+ contentWindow.appReopen = reopen;
contentWindow.appInitialURL = this.url_;
if (window.IN_TEST)
contentWindow.IN_TEST = true;
@@ -474,12 +477,16 @@ SingletonAppWindowWrapper.prototype = {__proto__: AppWindowWrapper.prototype};
* Activates an existing window or creates a new one.
*
* @param {Object} appState App state.
+ * @param {boolean} reopen True if the launching is triggered automatically.
+ * False otherwize.
* @param {function()=} opt_callback Completion callback.
*/
-SingletonAppWindowWrapper.prototype.launch = function(appState, opt_callback) {
+SingletonAppWindowWrapper.prototype.launch =
+ function(appState, reopen, opt_callback) {
// If the window is not opened yet, just call the parent method.
if (!this.openingOrOpened_) {
- AppWindowWrapper.prototype.launch.call(this, appState, opt_callback);
+ AppWindowWrapper.prototype.launch.call(
+ this, appState, reopen, opt_callback);
return;
}
@@ -487,6 +494,7 @@ SingletonAppWindowWrapper.prototype.launch = function(appState, opt_callback) {
// The queue is used to wait until the window is opened.
this.queue.run(function(nextStep) {
this.window_.contentWindow.appState = appState;
+ this.window_.contentWindow.appReopen = reopen;
this.window_.contentWindow.reload();
if (opt_callback)
opt_callback();
@@ -513,7 +521,7 @@ SingletonAppWindowWrapper.prototype.reopen = function(opt_callback) {
opt_callback && opt_callback();
return;
}
- this.launch(appState, opt_callback);
+ this.launch(appState, true, opt_callback);
}.bind(this));
};
@@ -657,7 +665,7 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
'main.html',
appId,
FILE_MANAGER_WINDOW_CREATE_OPTIONS);
- appWindow.launch(opt_appState || {}, function() {
+ appWindow.launch(opt_appState || {}, false, function() {
AppWindowWrapper.focusOnDesktop(
appWindow.window_, (opt_appState || {}).displayedId);
if (opt_callback)
@@ -783,7 +791,7 @@ audioPlayerInitializationQueue.run(function(callback) {
*/
function launchAudioPlayer(playlist, opt_displayedId) {
audioPlayerInitializationQueue.run(function(callback) {
- audioPlayer.launch(playlist, function(appWindow) {
+ audioPlayer.launch(playlist, false, function(appWindow) {
audioPlayer.setIcon(AUDIO_PLAYER_ICON);
AppWindowWrapper.focusOnDesktop(audioPlayer.rawAppWindow,
opt_displayedId);
@@ -802,7 +810,7 @@ var videoPlayer = new SingletonAppWindowWrapper('video_player.html',
* player should show.
*/
function launchVideoPlayer(url, opt_displayedId) {
- videoPlayer.launch({url: url}, function(appWindow) {
+ videoPlayer.launch({url: url}, false, function(appWindow) {
AppWindowWrapper.focusOnDesktop(videoPlayer.rawAppWindow, opt_displayedId);
});
}
« no previous file with comments | « chrome/browser/resources/file_manager/audio_player/js/audio_player.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698