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 | |
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
-rw-r--r-- | remoting/remoting_webapp_files.gypi | 1 | ||||
-rw-r--r-- | remoting/resources/remoting_strings.grd | 6 | ||||
-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 |
5 files changed, 54 insertions, 10 deletions
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 @@ <message desc="Android action-bar menu item for showing the Help and Feedback screen" name="IDS_ACTIONBAR_HELP" formatter_data="android_java"> Help & feedback </message> - <message desc="Label for the Feedback button displayed in the Android Help screen. Pressing this button causes the Feedback screen to be shown." name="IDS_ACTIONBAR_FEEDBACK" formatter_data="android_java"> - Feedback - </message> <message desc="Android action-bar menu item for viewing the Play Store page for the application" name="IDS_ACTIONBAR_PLAY_STORE" formatter_data="android_java"> View in Google Play Store </message> @@ -829,6 +826,9 @@ First release of Chrome Remote Desktop for Android. <message desc="Menu option to open a new window." name="IDS_NEW_WINDOW"> New window… </message> + <message desc="Label for the Feedback button displayed in the Android Help screen. Pressing this button causes the Feedback screen to be shown." name="IDS_ACTIONBAR_FEEDBACK" formatter_data="android_java"> + Feedback + </message> </messages> </release> </grit> 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?'; } }; |