Chromium Code Reviews| Index: chrome/browser/resources/hotword_audio_verification/event_page.js |
| diff --git a/chrome/browser/resources/hotword_audio_verification/event_page.js b/chrome/browser/resources/hotword_audio_verification/event_page.js |
| index ad421b3430bc5d725b5212775a80c776ea145844..3a77a2883dbfe43405c921eb7483e6531815298d 100644 |
| --- a/chrome/browser/resources/hotword_audio_verification/event_page.js |
| +++ b/chrome/browser/resources/hotword_audio_verification/event_page.js |
| @@ -2,15 +2,22 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +var appId = 'hotword_audio_verification_app'; |
| + |
| chrome.app.runtime.onLaunched.addListener(function() { |
| - // TODO(kcarattini): Check if the app is already running. If so, bring it |
| - // to focus rather than creating a new window. |
| + // We need to focus the window if it already exists, since it |
| + // is created as 'hidden'. |
| + var appWindow = chrome.app.window.get(appId); |
|
Dan Beam
2014/10/27 23:13:20
what if this window is hidden? do we need to unhi
kcarattini
2014/10/27 23:24:12
The window is always shown very shortly after bein
Dan Beam
2014/10/27 23:29:20
does this work with window managers that support h
kcarattini
2014/10/27 23:57:20
Added a note, as discussed.
|
| + if (appWindow) { |
| + appWindow.focus(); |
| + return; |
| + } |
| - // TODO(kcarattini): Don't show the window until the launch mode has been |
| - // established. |
| chrome.app.window.create('main.html', { |
| 'frame': 'none', |
| 'resizable': false, |
| + 'hidden': true, |
|
Dan Beam
2014/10/27 23:13:20
why is this created hidden?
kcarattini
2014/10/27 23:24:12
I had a bug where the window would flash grey for
|
| + 'id': appId, |
| 'bounds': { |
| 'width': 800, |
| 'height': 600 |