diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 00:35:02 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 00:35:02 +0000 |
commit | 7c7b711b565a4a8ec54ad1df76d1945dd451e2cd (patch) | |
tree | 9ec8662a3c7a370ad72aace19a7c8cbd0044741b /chrome/browser | |
parent | 16dc3d9df0b305a2c8693d1681189aa3af38ab2a (diff) | |
download | chromium_src-7c7b711b565a4a8ec54ad1df76d1945dd451e2cd.zip chromium_src-7c7b711b565a4a8ec54ad1df76d1945dd451e2cd.tar.gz chromium_src-7c7b711b565a4a8ec54ad1df76d1945dd451e2cd.tar.bz2 |
Added the extra iframe layer (central_roster_viewer.html) the enable the app
to run in the background. Moved JS code in separate scripts files. Implemented
logic to restart the roster if the user reloads the panel.
Patch by ivaylobakalov@chromium.org:
http://codereview.chromium.org/5255009
BUG=chromium-os:9485
TEST=none
Review URL: http://codereview.chromium.org/5314009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
7 files changed, 388 insertions, 282 deletions
diff --git a/chrome/browser/resources/chat_manager/background.html b/chrome/browser/resources/chat_manager/background.html index 46b7d23..ebb8a9a 100644 --- a/chrome/browser/resources/chat_manager/background.html +++ b/chrome/browser/resources/chat_manager/background.html @@ -12,132 +12,8 @@ to route both incoming and outgoing chats through this central roster. --> <body> -<script src="js/chatbridgeeventtypes.js"></script> -<script> - var centralRosterJid; - var centralRosterPort; - var centralJidListenerPorts = []; - - // Notify all port listeners of an event. - function forwardEventToPortListeners(evtType, chatJid) { - var listenerPort; - for (var portIndex in centralJidListenerPorts) { - listenerPort = centralJidListenerPorts[portIndex]; - listenerPort.postMessage({eventType: evtType, jid: chatJid}); - } - } - - // Notify all port listeners of updated central roster jid. - function forwardCentralRosterJidToPortListeners() { - forwardEventToPortListeners( - ChatBridgeEventTypes.CENTRAL_USER_UPDATE, centralRosterJid); - } - - // Central roster jid changed. Notify all listeners. - function centralJidUpdate(msg) { - if (centralRosterJid != msg.jid) { - centralRosterJid = msg.jid; - forwardCentralRosterJidToPortListeners(); - } - } - - // Focus a chat popup. - function focusMole(hostId) { - findMole(hostId, function(win) { - chrome.windows.update(win.id, {focused: true}); - }); - } - - // Find a chat popup from a chat's hostId and executes callback with it. - function findMole(hostId, callback) { - var matchUrlIdRegExp = new RegExp('[&?]id=' + hostId + '(&|$)', 'i'); - chrome.windows.getAll({populate: true}, function(wins) { - for (var winIdx = 0, win = wins[winIdx]; win; win = wins[++winIdx]) { - var tabs = win.tabs; - for (var tabIdx = 0, tab = tabs[tabIdx]; tab; tab = tabs[++tabIdx]) { - if ((tab.url).match(matchUrlIdRegExp)) { - callback(win); - return; - } - } - } - }); - } - - // Listen for content script connections. - chrome.extension.onConnect.addListener(function(port) { - // New central jid listener. - // Update with current central roster jid, and add to tracking array. - if (port.name == 'centralJidListener') { - centralJidListenerPorts.push(port); - port.postMessage({eventType: ChatBridgeEventTypes.CENTRAL_USER_UPDATE, - jid: centralRosterJid}); - - // Clear tracking array entry when content script closes. - port.onDisconnect.addListener(function(port) { - for (var index = 0; index < centralJidListenerPorts.length; ++index) { - var listenerPort = centralJidListenerPorts[index]; - if (listenerPort == port) { - centralJidListenerPorts.splice(index, 1); - break; - } - } - }); - // New central jid broadcaster. - // Add listener for jid changes, and track port for forwarding chats. - } else if (port.name == 'centralJidBroadcaster') { - if (centralRosterPort != port) { - if (centralRosterPort) { - centralRosterPort.onMessage.removeListener(centralJidUpdate); - } - centralRosterPort = port; - centralRosterPort.onMessage.addListener(centralJidUpdate); - - // Clear listener and central roster jid when content script closes - centralRosterPort.onDisconnect.addListener(function(port) { - if (centralRosterPort) { - centralRosterPort.onMessage.removeListener(centralJidUpdate); - centralRosterPort = null; - centralJidUpdate({jid: null}); - } - }); - } - } - }); - - // Listen for requests from our content scripts. - chrome.extension.onRequest.addListener( - function(request, sender, sendResponse) { - switch (request.msg) { - case ChatBridgeEventTypes.CENTRAL_USER_WATCHER: - sendResponse({jid: centralRosterJid}); - break; - // For new initiated chats, forward to the central roster port. - case ChatBridgeEventTypes.SHOW_CHAT: - case ChatBridgeEventTypes.START_VIDEO: - case ChatBridgeEventTypes.START_VOICE: - if (centralRosterPort) { - centralRosterPort.postMessage( - {eventType: request.msg, jid: request.jid}); - } else { - // We should not have been forwarded this message. Make sure our - // listeners are updated with the current central roster jid. - forwardCentralRosterJidToPortListeners(); - } - break; - case ChatBridgeEventTypes.OPENED_MOLE_INCOMING: - forwardEventToPortListeners(ChatBridgeEventTypes.OPENED_MOLE_OUTGOING, - request.jid); - break; - case ChatBridgeEventTypes.CLOSED_MOLE_INCOMING: - forwardEventToPortListeners(ChatBridgeEventTypes.CLOSED_MOLE_OUTGOING, - request.jid); - break; - case ChatBridgeEventTypes.MOLE_FOCUSED: - focusMole(request.jid); - break; - } - }); -</script> + <iframe id='centralRoster' src='central_roster.html'></iframe> + <script src="js/chatbridgeeventtypes.js"></script> + <script src="js/background.js"></script> </body> </html> diff --git a/chrome/browser/resources/chat_manager/central_roster.html b/chrome/browser/resources/chat_manager/central_roster.html index dd9b74b..30ace28 100644 --- a/chrome/browser/resources/chat_manager/central_roster.html +++ b/chrome/browser/resources/chat_manager/central_roster.html @@ -9,159 +9,31 @@ found in the LICENSE file. Central roster: hosting all Google Talk chats in ChromeOS. --> -<head> -<style> - .talk_roster, - .talk_iframe { - width: 100%; - height: 100%; - border: none; - padding: 0px; - overflow: hidden; - } - body { - margin: 0px; - padding: 0px; - overflow: hidden; - text-align: center; - } -</style> -<script> - var MIN_RETRY_MILLISECONDS = 1 * 1000; - var MAX_RETRY_MILLISECONDS = 4 * 60 * 1000; - var retryTime; - var retryTimer; - var chatClient = null; - - document.title = chrome.i18n.getMessage('CHAT_MANAGER_NAME'); - - // make sure there is only one central roster - function makeSingleton() { - // list of all chat manager popups - var chat_popups = []; - - chrome.windows.getAll({populate: true}, function(wins) { - // find all chat manager popups - for (var winIdx = 0, win = wins[winIdx]; win; win = wins[++winIdx]) { - var tabs = win.tabs; - for (var tabIdx = 0, tab = tabs[tabIdx]; tab; tab = tabs[++tabIdx]) { - if (tab.url === location.href) { - chat_popups.push({tabId: tab.id, winId: win.id}); - } - } + <head> + <style> + .talk_roster, + .talk_iframe { + width: 100%; + height: 100%; + border: none; + padding: 0px; + overflow: hidden; } - if (chat_popups.length > 0) { - // multiple popups are executing this function at the same time - // so we need a global criteria to pickup a "winner": - // "keep only the tab with smallest id" - chat_popups.sort(function(t1, t2) { return t1.tabId - t2.tabId; }); - for (var i = 0, l = chat_popups.length; i < l; i++) { - if (i == 0) { - chrome.windows.update(chat_popups[i].winId, {focused: true}); - } else { - chrome.tabs.remove(chat_popups[i].tabId); - } - } + body { + margin: 0px; + padding: 0px; + overflow: hidden; + text-align: center; } - }); - } - makeSingleton(); - - var args = { - 'protocol': 'https', - 'host': 'talkgadget.google.com', - 'jsmode': 'pre', - 'hl': chrome.i18n.getMessage('@@ui_locale'), - }; - - // Read args. - var urlParts = window.location.href.split(/[?&#]/); - for (var i = 1; i < urlParts.length; i++) { - var argParts = urlParts[i].split('='); - if (argParts.length == 2) { - args[argParts[0]] = argParts[1]; - } - } - var notifierScriptUrl = - args['protocol'] + '://' + args['host'] + - '/talkgadget/notifier-js?silent=true&host=' + - args['protocol'] + '://' + args['host'] + - '/talkgadget/notifier-js' + - (args['jsmode'] != '' ? ('&jsmode=' + args['jsmode']) : ''); - - function runGTalkScript() { - var script = document.createElement('script'); - script.src = notifierScriptUrl; - script.onload = loadGTalk; - script.onerror = loadGTalk; - document.body.appendChild(script); - } - function retryConnection() { - location.reload(); - } - function retryConnectionCountdown() { - var seconds = retryTime / 1000; - var minutes = Math.floor(seconds / 60); - seconds -= minutes * 60; - - document.getElementById('retryStatus').textContent = - chrome.i18n.getMessage('CHAT_MANAGER_RETRYING_IN', - [minutes, (seconds < 10 ? '0' : '') + seconds]); - - if (retryTime <= 0) { - retryConnection(); - } else { - retryTimer = setTimeout(retryConnectionCountdown, 1000); - retryTime -= 1000; - } - } - function loadGTalk() { - if (window.GTalkNotifier) { - document.getElementById('retryInfo').style.display = 'none'; - var baseUrl = args['protocol'] + '://' + args['host'] + '/talkgadget/'; - chatClient = new window.GTalkNotifier( - { - 'clientBaseUrl': baseUrl, - 'clientUrl': 'notifierclient' + - (args['jsmode'] != '' ? ('?jsmode=' + args['jsmode']) : ''), - 'propertyName': 'ChromeOS', - 'xpcRelay': baseUrl + 'xpc_relay', - 'xpcBlank': baseUrl + 'xpc_blank', - 'locale': args['hl'], - 'isCentralRoster': true, - 'hideProfileCard': true, - 'isFullFrame': true - } - ); - delete localStorage.retryStartTime; - } else { - if (!localStorage.retryStartTime) { - localStorage.retryStartTime = MIN_RETRY_MILLISECONDS; - } else if (localStorage.retryStartTime < MAX_RETRY_MILLISECONDS) { - localStorage.retryStartTime = Math.min(localStorage.retryStartTime * 2, - MAX_RETRY_MILLISECONDS); - } - retryTime = localStorage.retryStartTime; - document.getElementById('retryInfo').style.display = 'inline'; - retryConnectionCountdown(); - } - } - function onPageLoaded() { - // localize the page - document.getElementById('retryMessage').textContent = - chrome.i18n.getMessage('CHAT_MANAGER_COULD_NOT_CONNECT'); - document.getElementById('retryButton').value = - chrome.i18n.getMessage('CHAT_MANAGER_RETRY_NOW'); - - runGTalkScript(); - } -</script> -</head> -<body onload='onPageLoaded()'> - <div id='retryInfo' style='display:none'> - <p id='retryMessage'></p> - <p id='retryStatus'></p> - <input id='retryButton' type='button' value='' onclick='retryConnection()'/> - </div> -</body> + </style> + </head> + <body onload='onPageLoaded()'> + <div id='retryInfo' style='display:none'> + <p id='retryMessage'></p> + <p id='retryStatus'></p> + <input id='retryButton' type='button' value='' onclick='retryConnection()'/> + </div> + <script src="js/centralroster.js"></script> + </body> </html> + diff --git a/chrome/browser/resources/chat_manager/central_roster_viewer.html b/chrome/browser/resources/chat_manager/central_roster_viewer.html index e69de29..db91706 100644 --- a/chrome/browser/resources/chat_manager/central_roster_viewer.html +++ b/chrome/browser/resources/chat_manager/central_roster_viewer.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> +<!-- + +Copyright (c) 2010 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. + +--> + <head> + <style> + iframe { + width: 100%; + height: 100%; + border: none; + padding: 0px; + overflow: hidden; + } + body { + margin: 0px; + padding: 0px; + overflow: hidden; + } + </style> + </head> + <body onload='reparentCentralRosterToWindow();' + onbeforeunload='reparentCentralRosterToBackground(event);'> + <!-- Place for central roster --> + <script src="js/centralrosterviewer.js"></script> + </body> +</html> + diff --git a/chrome/browser/resources/chat_manager/js/background.js b/chrome/browser/resources/chat_manager/js/background.js new file mode 100644 index 0000000..638a04b --- /dev/null +++ b/chrome/browser/resources/chat_manager/js/background.js @@ -0,0 +1,128 @@ +// Copyright (c) 2010 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 centralRosterJid; +var centralRosterPort; +var centralJidListenerPorts = []; + +// Notify all port listeners of an event. +function forwardEventToPortListeners(evtType, chatJid) { + var listenerPort; + for (var portIndex in centralJidListenerPorts) { + listenerPort = centralJidListenerPorts[portIndex]; + listenerPort.postMessage({eventType: evtType, jid: chatJid}); + } +} + +// Notify all port listeners of updated central roster jid. +function forwardCentralRosterJidToPortListeners() { + forwardEventToPortListeners( + ChatBridgeEventTypes.CENTRAL_USER_UPDATE, centralRosterJid); +} + +// Central roster jid changed. Notify all listeners. +function centralJidUpdate(msg) { + if (centralRosterJid != msg.jid) { + centralRosterJid = msg.jid; + forwardCentralRosterJidToPortListeners(); + } +} + +// Focus a chat popup. +function focusMole(hostId) { + findMole(hostId, function(win) { + chrome.windows.update(win.id, {focused: true}); + }); +} + +// Find a chat popup from a chat's hostId and executes callback with it. +function findMole(hostId, callback) { + var matchUrlIdRegExp = new RegExp('[&?]id=' + hostId + '(&|$)', 'i'); + chrome.windows.getAll({populate: true}, function(wins) { + for (var winIdx = 0, win = wins[winIdx]; win; win = wins[++winIdx]) { + var tabs = win.tabs; + for (var tabIdx = 0, tab = tabs[tabIdx]; tab; tab = tabs[++tabIdx]) { + if ((tab.url).match(matchUrlIdRegExp)) { + callback(win); + return; + } + } + } + }); +} + +// Listen for content script connections. +chrome.extension.onConnect.addListener(function(port) { + // New central jid listener. + // Update with current central roster jid, and add to tracking array. + if (port.name == 'centralJidListener') { + centralJidListenerPorts.push(port); + port.postMessage({eventType: ChatBridgeEventTypes.CENTRAL_USER_UPDATE, + jid: centralRosterJid}); + + // Clear tracking array entry when content script closes. + port.onDisconnect.addListener(function(port) { + for (var index = 0; index < centralJidListenerPorts.length; ++index) { + var listenerPort = centralJidListenerPorts[index]; + if (listenerPort == port) { + centralJidListenerPorts.splice(index, 1); + break; + } + } + }); + // New central jid broadcaster. + // Add listener for jid changes, and track port for forwarding chats. + } else if (port.name == 'centralJidBroadcaster') { + if (centralRosterPort != port) { + if (centralRosterPort) { + centralRosterPort.onMessage.removeListener(centralJidUpdate); + } + centralRosterPort = port; + centralRosterPort.onMessage.addListener(centralJidUpdate); + + // Clear listener and central roster jid when content script closes + centralRosterPort.onDisconnect.addListener(function(port) { + if (centralRosterPort) { + centralRosterPort.onMessage.removeListener(centralJidUpdate); + centralRosterPort = null; + centralJidUpdate({jid: null}); + } + }); + } + } +}); + +// Listen for requests from our content scripts. +chrome.extension.onRequest.addListener( + function(request, sender, sendResponse) { + switch (request.msg) { + case ChatBridgeEventTypes.CENTRAL_USER_WATCHER: + sendResponse({jid: centralRosterJid}); + break; + // For new initiated chats, forward to the central roster port. + case ChatBridgeEventTypes.SHOW_CHAT: + case ChatBridgeEventTypes.START_VIDEO: + case ChatBridgeEventTypes.START_VOICE: + if (centralRosterPort) { + centralRosterPort.postMessage( + {eventType: request.msg, jid: request.jid}); + } else { + // We should not have been forwarded this message. Make sure our + // listeners are updated with the current central roster jid. + forwardCentralRosterJidToPortListeners(); + } + break; + case ChatBridgeEventTypes.OPENED_MOLE_INCOMING: + forwardEventToPortListeners(ChatBridgeEventTypes.OPENED_MOLE_OUTGOING, + request.jid); + break; + case ChatBridgeEventTypes.CLOSED_MOLE_INCOMING: + forwardEventToPortListeners(ChatBridgeEventTypes.CLOSED_MOLE_OUTGOING, + request.jid); + break; + case ChatBridgeEventTypes.MOLE_FOCUSED: + focusMole(request.jid); + break; + } +}); diff --git a/chrome/browser/resources/chat_manager/js/centralroster.js b/chrome/browser/resources/chat_manager/js/centralroster.js new file mode 100644 index 0000000..449a3da --- /dev/null +++ b/chrome/browser/resources/chat_manager/js/centralroster.js @@ -0,0 +1,137 @@ +// Copyright (c) 2010 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 MIN_RETRY_MILLISECONDS = 1 * 1000; +var MAX_RETRY_MILLISECONDS = 4 * 60 * 1000; +var retryTime; +var retryTimer; +var chatClient = null; + +document.title = chrome.i18n.getMessage('CHAT_MANAGER_NAME'); +var args = { + 'protocol': 'https', + 'host': 'talkgadget.google.com', + 'jsmode': 'pre', + 'hl': chrome.i18n.getMessage('@@ui_locale') +}; + +// Read args. +var urlParts = window.location.href.split(/[?&#]/); +for (var i = 1; i < urlParts.length; i++) { + var argParts = urlParts[i].split('='); + if (argParts.length == 2) { + args[argParts[0]] = argParts[1]; + } +} +var notifierScriptUrl = + args['protocol'] + '://' + args['host'] + + '/talkgadget/notifier-js?silent=true&host=' + + args['protocol'] + '://' + args['host'] + + '/talkgadget/notifier-js' + + (args['jsmode'] != '' ? ('&jsmode=' + args['jsmode']) : ''); + +// Implement Singleton pattern, where there is only one central roster. +function makeSingleton() { + // This will keep a list of all central roster panels. + var chat_popups = []; + + chrome.windows.getAll({populate: true}, function(wins) { + // Find and remember all central roster panels. + for (var winIdx = 0, win = wins[winIdx]; win; win = wins[++winIdx]) { + var tabs = win.tabs; + for (var tabIdx = 0, tab = tabs[tabIdx]; tab; tab = tabs[++tabIdx]) { + if (tab.url === location.href) { + chat_popups.push({tabId: tab.id, winId: win.id}); + } + } + } + if (chat_popups.length > 0) { + // Multiple panels are executing this function at the same time so we need + // a global criteria to pickup a "winner": "keep only the tab with + // smallest id". + chat_popups.sort(function(t1, t2) { return t1.tabId - t2.tabId; }); + for (var i = 0, l = chat_popups.length; i < l; i++) { + if (i == 0) { + chrome.windows.update(chat_popups[i].winId, {focused: true}); + } else { + chrome.tabs.remove(chat_popups[i].tabId); + } + } + } + }); +} +makeSingleton(); + +function runGTalkScript() { + var script = document.createElement('script'); + script.src = notifierScriptUrl; + script.onload = loadGTalk; + script.onerror = loadGTalk; + document.body.appendChild(script); +} + +function retryConnection() { + location.reload(); +} + +function retryConnectionCountdown() { + var seconds = retryTime / 1000; + var minutes = Math.floor(seconds / 60); + seconds -= minutes * 60; + + document.getElementById('retryStatus').textContent = + chrome.i18n.getMessage('CHAT_MANAGER_RETRYING_IN', + [minutes, (seconds < 10 ? '0' : '') + seconds]); + + if (retryTime <= 0) { + retryConnection(); + } else { + retryTimer = setTimeout(retryConnectionCountdown, 1000); + retryTime -= 1000; + } +} + +function loadGTalk() { + if (window.GTalkNotifier) { + document.getElementById('retryInfo').style.display = 'none'; + var baseUrl = args['protocol'] + '://' + args['host'] + '/talkgadget/'; + chatClient = new window.GTalkNotifier( + { + 'clientBaseUrl': baseUrl, + 'clientUrl': 'notifierclient' + + (args['jsmode'] != '' ? ('?jsmode=' + args['jsmode']) : ''), + 'propertyName': 'ChromeOS', + 'xpcRelay': baseUrl + 'xpc_relay', + 'xpcBlank': baseUrl + 'xpc_blank', + 'locale': args['hl'], + 'isCentralRoster': true, + 'hideProfileCard': true, + 'isFullFrame': true + } + ); + delete localStorage.retryStartTime; + } else { + if (!localStorage.retryStartTime) { + localStorage.retryStartTime = MIN_RETRY_MILLISECONDS; + } else if (localStorage.retryStartTime < MAX_RETRY_MILLISECONDS) { + localStorage.retryStartTime = Math.min(localStorage.retryStartTime * 2, + MAX_RETRY_MILLISECONDS); + } + retryTime = localStorage.retryStartTime; + document.getElementById('retryInfo').style.display = 'inline'; + retryConnectionCountdown(); + } +} + +function onPageLoaded() { + // Localizing the page content. + document.getElementById('retryMessage').textContent = + chrome.i18n.getMessage('CHAT_MANAGER_COULD_NOT_CONNECT'); + document.getElementById('retryButton').value = + chrome.i18n.getMessage('CHAT_MANAGER_RETRY_NOW'); + + if (localStorage.hasOpenedInViewer) { + runGTalkScript(); + } +} diff --git a/chrome/browser/resources/chat_manager/js/centralrosterviewer.js b/chrome/browser/resources/chat_manager/js/centralrosterviewer.js new file mode 100644 index 0000000..0229a68 --- /dev/null +++ b/chrome/browser/resources/chat_manager/js/centralrosterviewer.js @@ -0,0 +1,61 @@ +// Copyright (c) 2010 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. + +document.title = chrome.i18n.getMessage('CHAT_MANAGER_NAME'); + +function reparentCentralRosterToWindow() { + var backgroundWindow = chrome.extension.getBackgroundPage(); + if (backgroundWindow) { + var backgroundDocument = backgroundWindow.document; + var iframe = backgroundDocument.getElementById('centralRoster'); + if (iframe) { + if ((new Date().getTime() - localStorage.rosterClosed) < 500) { + // If the 'unload' is followed by 'load' in less than 0.5 seconds + // we assume it is a page refresh and the user wants to restart the app. + iframe.parentNode.removeChild(iframe); + iframe = backgroundDocument.createElement('iframe'); + iframe.id ='centralRoster'; + iframe.src ='central_roster.html'; + } + if (document.adoptNode) { + document.adoptNode(iframe); + } + document.body.appendChild(iframe); + + if (!localStorage.hasOpenedInViewer) { + // This is the first time the user started the app, so we'll remember + // the event, check if the centralRoster frame has already been loaded + // and start the app and that case. + localStorage.hasOpenedInViewer = true; + if (iframe.contentWindow.runGTalkScript) { + iframe.contentWindow.runGTalkScript(); + } + } + } else { + // If there in no centralRoster frame in background page, this must be + // a second panel trying to load the central roster. + window.close(); + } + } +} + +function reparentCentralRosterToBackground(event) { + // We'll remember when was the last time the central roster panel closes + // in order to detect if it is a close on reload action. + localStorage.rosterClosed = new Date().getTime(); + + if (document) { + var iframe = document.getElementById('centralRoster'); + if (iframe) { + var backgroundWindow = chrome.extension.getBackgroundPage(); + if (backgroundWindow) { + var backgroundDocument = backgroundWindow.document; + if (backgroundDocument.adoptNode) { + backgroundDocument.adoptNode(iframe); + } + backgroundDocument.body.appendChild(iframe); + } + } + } +} diff --git a/chrome/browser/resources/chat_manager/manifest.json b/chrome/browser/resources/chat_manager/manifest.json index 0fe39b1..442a46d 100644 --- a/chrome/browser/resources/chat_manager/manifest.json +++ b/chrome/browser/resources/chat_manager/manifest.json @@ -1,7 +1,7 @@ { "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDrlwvcbUtVrbQvI7EPV1BTa63N8YkbBToHzxlMl0IzSBwOV+TUOsHE8vRq0HZWuwMAGeH8WdWVC3HRNdES8lScjlzxb1TsTQJAsF+hLXgcjgCUSSSGCfFzypvuvKsRQTx0d02yfWKJa47o0Ws5wL72NVtc7c51HujwWYg+Mz01wIDAQAB", "name": "__MSG_CHAT_MANAGER_NAME__", - "version": "1.0.18", + "version": "1.0.19", "icons": { "128": "128.png", "16": "16.png", @@ -39,7 +39,7 @@ ], "app": { "launch": { - "local_path": "central_roster.html", + "local_path": "central_roster_viewer.html", "container": "panel", "width": 225, "height": 316 |