1 // Copyright 2015 The ChromeOS IME Authors. All Rights Reserved.
2 // limitations under the License.
3 // See the License for the specific language governing permissions and
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 // distributed under the License is distributed on an "AS-IS" BASIS,
6 // Unless required by applicable law or agreed to in writing, software
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // You may obtain a copy of the License at
11 // you may not use this file except in compliance with the License.
12 // Licensed under the Apache License, Version 2.0 (the "License");
14 goog
.provide('i18n.input.chrome.WindowUtil');
16 goog
.require('goog.events');
17 goog
.require('goog.object');
20 goog
.scope(function() {
21 var WindowUtil
= i18n
.input
.chrome
.WindowUtil
;
25 * The empty floating window url.
29 WindowUtil
.EMPTY_WINDOW_URL_
= 'imewindows/window.html';
33 * Create an empty floating window.
35 * @param {!Function} callback .
36 * @param {Object.<string, *>=} opt_overridedOption .
37 * @param {string=} opt_urlParameter .
39 WindowUtil
.createWindow = function(callback
, opt_overridedOption
,
41 var options
= goog
.object
.create(
47 if (opt_overridedOption
) {
48 goog
.object
.forEach(opt_overridedOption
, function(value
, key
) {
52 var url
= opt_urlParameter
? WindowUtil
.EMPTY_WINDOW_URL_
+ opt_urlParameter
:
53 WindowUtil
.EMPTY_WINDOW_URL_
;
54 // Right now Input Tool extension don't support floating window,
55 // will support later. So adds condition to guard it.
56 if (chrome
.app
.window
&& chrome
.app
.window
.create
) {
57 inputview
.createWindow(url
, options
,
58 WindowUtil
.createWindowCb_
.bind(WindowUtil
, callback
));
64 * Callback for "inputview.createWindow".
66 * @param {!Function} callback .
67 * @param {chrome.app.window.AppWindow} newWindow .
70 WindowUtil
.createWindowCb_ = function(callback
, newWindow
) {
72 var contentWindow
= newWindow
.contentWindow
;
73 goog
.events
.listen(contentWindow
, 'load', function() {