From 71cd0639a28c88ef57cd4dd21ff83948ac74b550 Mon Sep 17 00:00:00 2001 From: "jamiewalch@chromium.org" Date: Fri, 11 Apr 2014 22:02:55 +0000 Subject: 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 --- remoting/remoting_webapp_files.gypi | 1 + remoting/resources/remoting_strings.grd | 6 ++--- remoting/webapp/feedback.js | 42 +++++++++++++++++++++++++++++++++ remoting/webapp/html/ui_header.html | 3 ++- remoting/webapp/remoting.js | 12 +++++----- 5 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 remoting/webapp/feedback.js (limited to 'remoting') diff --git a/remoting/remoting_webapp_files.gypi b/remoting/remoting_webapp_files.gypi index 1a74de7..c4bcc69 100644 --- a/remoting/remoting_webapp_files.gypi +++ b/remoting/remoting_webapp_files.gypi @@ -84,6 +84,7 @@ 'webapp/menu_button.js', 'webapp/ui_mode.js', 'webapp/toolbar.js', + 'webapp/feedback.js', ], # UI files for controlling the local machine as a host. 'remoting_webapp_js_ui_host_control_files': [ diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index 1afc37f..6400298 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd @@ -414,9 +414,6 @@ Help & feedback - - Feedback - View in Google Play Store @@ -829,6 +826,9 @@ First release of Chrome Remote Desktop for Android. New window… + + Feedback + 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. --> | + target="_blank" i18n-content="HELP"> | + 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?'; } }; -- cgit v1.1