| 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 /** @suppress {duplicate} */ | 5 /** @suppress {duplicate} */ |
| 6 var remoting = remoting || {}; | 6 var remoting = remoting || {}; |
| 7 | 7 |
| 8 (function(){ | 8 (function(){ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 /** @type {string} */ | 12 /** @type {string} */ |
| 13 var NEW_WINDOW_MENU_ID_ = 'new-window'; | 13 var NEW_WINDOW_MENU_ID_ = 'new-window'; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * A class that handles application activation. | 16 * A class that handles application activation. |
| 17 * | 17 * |
| 18 * @param {base.Ipc} ipc | 18 * @param {base.Ipc} ipc |
| 19 * @param {remoting.V2AppLauncher} appLauncher | 19 * @param {remoting.V2AppLauncher} appLauncher |
| 20 * @constructor | 20 * @constructor |
| 21 */ | 21 */ |
| 22 remoting.ActivationHandler = function (ipc, appLauncher) { | 22 remoting.ActivationHandler = function (ipc, appLauncher) { |
| 23 /** | 23 /** @private {remoting.V2AppLauncher} */ |
| 24 * @type {remoting.V2AppLauncher} | |
| 25 * @private | |
| 26 */ | |
| 27 this.appLauncher_ = appLauncher; | 24 this.appLauncher_ = appLauncher; |
| 28 | 25 |
| 29 chrome.contextMenus.create({ | 26 chrome.contextMenus.create({ |
| 30 id: NEW_WINDOW_MENU_ID_, | 27 id: NEW_WINDOW_MENU_ID_, |
| 31 contexts: ['launcher'], | 28 contexts: ['launcher'], |
| 32 title: chrome.i18n.getMessage(/*i18n-content*/'NEW_WINDOW') | 29 title: chrome.i18n.getMessage(/*i18n-content*/'NEW_WINDOW') |
| 33 }); | 30 }); |
| 34 | 31 |
| 35 chrome.contextMenus.onClicked.addListener(this.onContextMenu_.bind(this)); | 32 chrome.contextMenus.onClicked.addListener(this.onContextMenu_.bind(this)); |
| 36 chrome.app.runtime.onLaunched.addListener(this.onLaunched_.bind(this)); | 33 chrome.app.runtime.onLaunched.addListener(this.onLaunched_.bind(this)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 62 */ | 59 */ |
| 63 remoting.ActivationHandler.prototype.onLaunched_ = function() { | 60 remoting.ActivationHandler.prototype.onLaunched_ = function() { |
| 64 var windows = chrome.app.window.getAll(); | 61 var windows = chrome.app.window.getAll(); |
| 65 if (windows.length >= 1) { | 62 if (windows.length >= 1) { |
| 66 windows[windows.length - 1].focus(); | 63 windows[windows.length - 1].focus(); |
| 67 } else { | 64 } else { |
| 68 this.appLauncher_.launch(); | 65 this.appLauncher_.launch(); |
| 69 } | 66 } |
| 70 }; | 67 }; |
| 71 | 68 |
| 72 })(); | 69 })(); |
| OLD | NEW |