| Index: chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js
|
| diff --git a/chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js b/chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..88b27e5cf2af957b6d710ec4e2c10faef85517e7
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js
|
| @@ -0,0 +1,49 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +var windowLoaded = false;
|
| +var messaged = false;
|
| +var iframeI18n = undefined;
|
| +var appWindow = undefined;
|
| +
|
| +chrome.app.runtime.onLaunched.addListener(function() {
|
| + chrome.app.window.create('window.html', {
|
| + id: "mainwin",
|
| + innerBounds: {
|
| + width: 700,
|
| + height: 600
|
| + }
|
| + }, function(win) {
|
| + appWindow = win;
|
| + appWindow.contentWindow.onload = function() {
|
| + windowLoaded = true;
|
| + chrome.test.log('Window loaded: ' + windowLoaded);
|
| + chrome.test.log('Iframe i18n: ' + iframeI18n);
|
| + // If the message already arrived, report the i18n state.
|
| + if (messaged) {
|
| + appWindow.contentWindow.reportChromeI18nState(
|
| + chrome.i18n != undefined, iframeI18n);
|
| + }
|
| + };
|
| + });
|
| +});
|
| +
|
| +function initialize() {
|
| + var iframe = document.createElement('iframe');
|
| + iframe.src = '/iframe.html';
|
| + iframe.style.display = 'none';
|
| +
|
| + document.body.appendChild(iframe);
|
| +
|
| + window.addEventListener('message', function(e) {
|
| + messaged = true;
|
| + iframeI18n = e.data;
|
| + if (windowLoaded) {
|
| + appWindow.contentWindow.reportChromeI18nState(
|
| + chrome.i18n != undefined, iframeI18n);
|
| + }
|
| + });
|
| +};
|
| +
|
| +initialize();
|
|
|