summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-09 02:55:56 +0000
committerjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-09 02:55:56 +0000
commit9fc675ebaf4176791bbf854945c62767c36d4a1f (patch)
tree0c30f774f48a14430cc04d11e9a4977c0ee7e564 /remoting
parent9e45dba062414852ca74c56d12dbe61a48a49b84 (diff)
downloadchromium_src-9fc675ebaf4176791bbf854945c62767c36d4a1f.zip
chromium_src-9fc675ebaf4176791bbf854945c62767c36d4a1f.tar.gz
chromium_src-9fc675ebaf4176791bbf854945c62767c36d4a1f.tar.bz2
Detect the start-up type of the application.
BUG=121771 TEST=Manual Review URL: https://chromiumcodereview.appspot.com/10068020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181592 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/resources/remoting_strings.grd6
-rw-r--r--remoting/webapp/jscompiler_hacks.js34
-rw-r--r--remoting/webapp/main.css5
-rw-r--r--remoting/webapp/main.html13
-rw-r--r--remoting/webapp/remoting.js66
5 files changed, 114 insertions, 10 deletions
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd
index d3efbba..532c534 100644
--- a/remoting/resources/remoting_strings.grd
+++ b/remoting/resources/remoting_strings.grd
@@ -510,6 +510,12 @@
<message desc="Message displayed at the bottom of the host screen if local policy dictates that NAT traversal is disabled, meaning that connections outside the local network will not work." name="IDR_WARNING_NAT_DISABLED">
NOTE: Policy settings permit connections only between computers within your network.
</message>
+ <message desc="Message displayed at the bottom of the client connect dialog if Chromoting is running in the wrong start-up mode." name="IDR_WARNING_NOT_WINDOWED">
+ NOTE: To ensure that all keyboard shortcuts are available, you can configure Chromoting to ‘Open as window’.
+ </message>
+ <message desc="Link to learn more detailed information on a topic." name="IDR_LEARN_HOW">
+ Learn how.
+ </message>
<message desc="Help link displayed when the user enables the host on this computer. Clicking this link opens a page that explains why this operation is safe. This string appears in a UI with limited horizontal space. Please try to keep translations no more than about 30 characters." name="IDR_WHY_IS_THIS_SAFE">
Why is this safe?
</message>
diff --git a/remoting/webapp/jscompiler_hacks.js b/remoting/webapp/jscompiler_hacks.js
index c2fc838..9f16a56 100644
--- a/remoting/webapp/jscompiler_hacks.js
+++ b/remoting/webapp/jscompiler_hacks.js
@@ -3,8 +3,8 @@
// found in the LICENSE file.
// This file contains various hacks needed to inform JSCompiler of various
-// WebKit-specific properties and methods. It is used only with JSCompiler
-// to verify the type-correctness of our code.
+// WebKit- and Chrome-specific properties and methods. It is used only with
+// JSCompiler to verify the type-correctness of our code.
/** @type {HTMLElement} */
Document.prototype.activeElement;
@@ -112,3 +112,33 @@ chrome.runtime = {
message: ''
}
};
+
+/** @type {Object} */
+chrome.tabs;
+
+/** @param {function(chrome.Tab):void} callback */
+chrome.tabs.getCurrent = function(callback) {}
+
+/** @constructor */
+chrome.Tab = function() {
+ /** @type {boolean} */
+ this.pinned = false;
+ /** @type {number} */
+ this.windowId = 0;
+};
+
+/** @type {Object} */
+chrome.windows;
+
+/** @param {number} id
+ * @param {Object?} getInfo
+ * @param {function(chrome.Window):void} callback */
+chrome.windows.get = function(id, getInfo, callback) {}
+
+/** @constructor */
+chrome.Window = function() {
+ /** @type {string} */
+ this.state = '';
+ /** @type {string} */
+ this.type = '';
+};
diff --git a/remoting/webapp/main.css b/remoting/webapp/main.css
index 656208a..ee70c05 100644
--- a/remoting/webapp/main.css
+++ b/remoting/webapp/main.css
@@ -369,6 +369,7 @@ section {
padding: 8px 16px;
text-align: center;
font-size: 12px;
+ margin-top: 30px;
}
.message {
@@ -542,10 +543,6 @@ button {
height: 0;
}
-#nat-box {
- margin-top: 30px;
-}
-
/* The NAT traversal state is independent of the app mode, and both need
* to be combined to determine the visibility of the butter bar. We use
* a style for the former and the 'hidden' property for the latter. */
diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html
index 061caeb..9e6537f 100644
--- a/remoting/webapp/main.html
+++ b/remoting/webapp/main.html
@@ -463,6 +463,13 @@ found in the LICENSE file.
</div>
</form>
</div> <!-- code-entry-row -->
+ <div id="startup-mode-box-it2me" class="information-box" hidden>
+ <span i18n-content="WARNING_NOT_WINDOWED"></span>
+ <a href="http://support.google.com/chrome/bin/answer.py?hl=en&answer=1649523"
+ target="_blank"
+ i18n-content="LEARN_HOW"></a>
+ </div> <!-- startup-mode-box-it2me -->
+
</div> <!-- client.unconnected -->
<div data-ui-mode="home.client.connecting" class="box">
@@ -494,6 +501,12 @@ found in the LICENSE file.
i18n-content="CANCEL">
</button>
</form>
+ <div id="startup-mode-box-me2me" class="information-box" hidden>
+ <span i18n-content="WARNING_NOT_WINDOWED"></span>
+ <a href="http://support.google.com/chrome/bin/answer.py?hl=en&answer=1649523"
+ target="_blank"
+ i18n-content="LEARN_HOW"></a>
+ </div> <!-- startup-mode-box-it2me -->
</div>
</div> <!-- client.pin-prompt -->
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index f89072a..d1ca071 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -31,6 +31,17 @@ function consentRequired_(authContinue) {
}
/**
+ * @enum {string} The start-up mode of the web-app
+ */
+remoting.TabType = {
+ REGULAR: 'REGULAR',
+ PINNED: 'PINNED',
+ WINDOWED: 'WINDOWED',
+ FULLSCREEN: 'FULLSCREEN',
+ UNKNOWN: 'UNKNOWN'
+};
+
+/**
* Entry point for app initialization.
*/
remoting.init = function() {
@@ -96,6 +107,16 @@ remoting.init = function() {
remoting.initDaemonUi();
}
remoting.hostList.load(onLoad);
+
+ // Show the tab-type warnings if necessary.
+ /** @param {remoting.TabType} tabType */
+ var onTabTypeKnown = function(tabType) {
+ if (tabType != remoting.TabType.WINDOWED) {
+ document.getElementById('startup-mode-box-me2me').hidden = false;
+ document.getElementById('startup-mode-box-it2me').hidden = false;
+ }
+ };
+ getTabType_(onTabTypeKnown);
};
/**
@@ -111,9 +132,9 @@ remoting.onEmail = function(email) {
document.getElementById('get-started-me2me').disabled = false;
};
-// initDaemonUi is called if the app is not starting up in session mode, and
-// also if the user cancels pin entry or the connection in session mode.
-remoting.initDaemonUi = function () {
+/** initDaemonUi is called if the app is not starting up in session mode, and
+ * also if the user cancels pin entry or the connection in session mode. */
+remoting.initDaemonUi = function() {
remoting.hostController = new remoting.HostController();
document.getElementById('share-button').disabled =
!remoting.hostController.isPluginSupported();
@@ -279,7 +300,7 @@ function jsonParseSafe(jsonString) {
* Return the current time as a formatted string suitable for logging.
*
* @return {string} The current time, formatted as [mmdd/hhmmss.xyz]
-*/
+ */
remoting.timestamp = function() {
/**
* @param {number} num A number.
@@ -317,3 +338,40 @@ remoting.showErrorMessage = function(error) {
document.getElementById('token-refresh-other-error').hidden = auth_failed;
remoting.setMode(remoting.AppMode.TOKEN_REFRESH_FAILED);
};
+
+/**
+ * Get the start-up mode of the application.
+ * @param {function(remoting.TabType):void} callback Callback to receive the
+ * type start-up mode of the application (the type of the current tab).
+ */
+function getTabType_(callback) {
+ /** @param {chrome.Window} win The current window. */
+ var windowCallback = function(win) {
+ switch (win.state) {
+ case 'fullscreen':
+ callback(remoting.TabType.FULLSCREEN);
+ return;
+ case 'normal':
+ switch (win.type) {
+ case 'normal':
+ callback(remoting.TabType.REGULAR);
+ return;
+ case 'popup':
+ case 'app':
+ callback(remoting.TabType.WINDOWED);
+ return;
+ }
+ }
+ // TODO(jamiewalch): Decide what to do about "panel".
+ callback(remoting.TabType.UNKNOWN);
+ };
+ /** @param {chrome.Tab} tab The current tab. */
+ var tabCallback = function(tab) {
+ if (tab.pinned) {
+ callback(remoting.TabType.PINNED);
+ } else {
+ chrome.windows.get(tab.windowId, null, windowCallback);
+ }
+ };
+ chrome.tabs.getCurrent(tabCallback);
+}