diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-11 22:02:55 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-11 22:02:55 +0000 |
commit | 71cd0639a28c88ef57cd4dd21ff83948ac74b550 (patch) | |
tree | b75a931eb67f0c0f640521540b64e4e2ad64e154 /remoting/webapp | |
parent | 164193d09cf19d19c869acb1d5ce1f25c1a1a082 (diff) | |
download | chromium_src-71cd0639a28c88ef57cd4dd21ff83948ac74b550.zip chromium_src-71cd0639a28c88ef57cd4dd21ff83948ac74b550.tar.gz chromium_src-71cd0639a28c88ef57cd4dd21ff83948ac74b550.tar.bz2 |
Add Feedback link to the app.
This only adds it to the home screen. I will follow up with a CL that refactors
the in-session tool-bar to allow us to add it there as well.
BUG=343773
NOTRY=true
R=garykac@chromium.org
Review URL: https://codereview.chromium.org/233973004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263374 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp')
-rw-r--r-- | remoting/webapp/feedback.js | 42 | ||||
-rw-r--r-- | remoting/webapp/html/ui_header.html | 3 | ||||
-rw-r--r-- | remoting/webapp/remoting.js | 12 |
3 files changed, 50 insertions, 7 deletions
diff --git a/remoting/webapp/feedback.js b/remoting/webapp/feedback.js new file mode 100644 index 0000000..1ecbc19 --- /dev/null +++ b/remoting/webapp/feedback.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 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. + +'use strict'; + +var remoting = remoting || {}; + +/** + * Show or hide the feedback button based on whether or not the current version + * of Chrome recognizes Chrome Remote Desktop as an authorized feedback source. + * + * @param {HTMLElement} feedbackButton + */ +remoting.initFeedback = function(feedbackButton) { + var chromeVersion = parseInt( + window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10); + if (chromeVersion >= 35) { + feedbackButton.hidden = false; + feedbackButton.addEventListener('click', remoting.sendFeedback, false); + } else { + feedbackButton.hidden = true; + } +}; + +/** + * Pass the current version of Chrome Remote Desktop to the Google Feedback + * extension and instruct it to show the feedback dialog. + */ +remoting.sendFeedback = function() { + var message = { + requestFeedback: true, + feedbackInfo: { + description: '', + systemInformation: [ + { key: 'version', value: remoting.getExtensionInfo() } + ] + } + }; + var kFeedbackExtensionId = 'gfdkimpbcpahaombhbimeihdjnejgicl'; + chrome.runtime.sendMessage(kFeedbackExtensionId, message, function() {}); +};
\ No newline at end of file diff --git a/remoting/webapp/html/ui_header.html b/remoting/webapp/html/ui_header.html index ba366a8..45551fc 100644 --- a/remoting/webapp/html/ui_header.html +++ b/remoting/webapp/html/ui_header.html @@ -22,7 +22,8 @@ found in the LICENSE file. --> </span> | <a href="https://www.google.com/support/chrome/bin/answer.py?answer=1649523" - target="_blank" i18n-content="HELP"></a> + target="_blank" i18n-content="HELP"></a> | + <a id="send-feedback" i18n-content="ACTIONBAR_FEEDBACK"></a> </div> </header> diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js index 4c5efadd..9e15be8 100644 --- a/remoting/webapp/remoting.js +++ b/remoting/webapp/remoting.js @@ -53,7 +53,7 @@ remoting.init = function() { migrateLocalToChromeStorage_(); } - remoting.logExtensionInfo_(); + console.log(remoting.getExtensionInfo()); l10n.localize(); // Create global objects. @@ -102,6 +102,7 @@ remoting.init = function() { window.addEventListener('copy', pluginGotCopy_, false); remoting.initModalDialogs(); + remoting.initFeedback(document.getElementById('send-feedback')); if (isHostModeSupported_()) { var noShare = document.getElementById('chrome-os-no-share'); @@ -282,17 +283,16 @@ remoting.updateLocalHostState = function() { }; /** - * Log information about the current extension. - * The extension manifest is parsed to extract this info. + * @return {string} Information about the current extension. */ -remoting.logExtensionInfo_ = function() { +remoting.getExtensionInfo = function() { var v2OrLegacy = remoting.isAppsV2 ? " (v2)" : " (legacy)"; var manifest = chrome.runtime.getManifest(); if (manifest && manifest.version) { var name = chrome.i18n.getMessage('PRODUCT_NAME'); - console.log(name + ' version: ' + manifest.version + v2OrLegacy); + return name + ' version: ' + manifest.version + v2OrLegacy; } else { - console.error('Failed to get product version. Corrupt manifest?'); + return 'Failed to get product version. Corrupt manifest?'; } }; |