diff options
author | garykac <garykac@chromium.org> | 2015-07-06 15:08:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-06 22:09:16 +0000 |
commit | 7d47f7a394e09e1a6e3e546932051649f185d47e (patch) | |
tree | b938afe2e61f866ede24dc5c4d2821d509b35ca1 /remoting | |
parent | 990d54c8d31b2cb44ebc9b21b8d3596269124b81 (diff) | |
download | chromium_src-7d47f7a394e09e1a6e3e546932051649f185d47e.zip chromium_src-7d47f7a394e09e1a6e3e546932051649f185d47e.tar.gz chromium_src-7d47f7a394e09e1a6e3e546932051649f185d47e.tar.bz2 |
[AppRemoting] Break out AppRemoting shared module.
This is a reland of crrev.com/1179873005 with the following fixes:
Added GYP build of shared module
Updated build-webapp.py script to not check env for shared module
This fixes the GN Release build problem
This cl breaks out the shared AppRemoting code into a shared module so
that it does not need to be duplicated in each individual app.
This version has the following limitations which will be addressed in
follow-up cls:
(1) The apps have a hard-coded reference to the dev shared module
(2) The apps have a hard-coded reference to the dev orchestrator
(3) The resources in the app stub should be replaced with empty stub
resources rather than a copy of all the shared resources.
BUG=
Review URL: https://codereview.chromium.org/1188253009
Cr-Commit-Position: refs/heads/master@{#337487}
Diffstat (limited to 'remoting')
33 files changed, 675 insertions, 322 deletions
diff --git a/remoting/app_remoting_shared_module.gyp b/remoting/app_remoting_shared_module.gyp new file mode 100644 index 0000000..459e610 --- /dev/null +++ b/remoting/app_remoting_shared_module.gyp @@ -0,0 +1,215 @@ +# Copyright 2015 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. + +{ + 'includes': [ + 'remoting_version.gypi', + 'remoting_locales.gypi', + 'remoting_options.gypi', + 'remoting_webapp_files.gypi', + 'app_remoting_webapp_files.gypi', + ], + 'targets': [ + { + # GN version: //remoting/webapp:ar_shared_module + 'target_name': 'ar_shared_module', + 'type': 'none', + + + 'variables': { + 'app_key': 'Sample_App', + 'app_id': 'ljacajndfccfgnfohlgkdphmbnpkjflk', + 'app_client_id': 'sample_client_id', + 'app_name': 'App Remoting Client', + 'app_description': 'App Remoting client', + + 'ar_shared_module_manifest': 'webapp/app_remoting/shared_module/manifest.json', + + 'ar_generated_html_files': [ + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/ar_background.html', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/loading_window.html', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/message_window.html', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/feedback_consent.html', + '<(SHARED_INTERMEDIATE_DIR)/remoting/credits.html', + ], + 'ar_shared_module_files': [ + '<@(ar_shared_resource_files)', + '<@(ar_all_js_files)', + '<@(ar_generated_html_files)', + ], + 'output_dir': '<(PRODUCT_DIR)/app_streaming/>(_target_name)', + 'zip_path': '<(PRODUCT_DIR)/app_streaming/>(_target_name).zip', + + 'ar_shared_module_locales_listfile': '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)_locales.txt', + + }, + + + 'actions': [ + { + 'action_name': 'Build ar_shared_module locales listfile', + 'inputs': [ + '<(remoting_localize_path)', + ], + 'outputs': [ + '<(ar_shared_module_locales_listfile)', + ], + 'action': [ + 'python', '<(remoting_localize_path)', + '--locale_output', + '"<(webapp_locale_dir)/@{json_suffix}/messages.json"', + '--locales_listfile', + '<(ar_shared_module_locales_listfile)', + '<@(remoting_locales)', + ], + }, + { + 'action_name': 'Build ar_shared_module application stub', + 'inputs': [ + '<(DEPTH)/remoting/webapp/build-webapp.py', + '<(chrome_version_path)', + '<(remoting_version_path)', + '<@(ar_shared_module_files)', + '<@(remoting_webapp_locale_files)', + '<(ar_shared_module_manifest)', + '<(ar_shared_module_locales_listfile)', + ], + 'outputs': [ + '<(output_dir)', + '<(zip_path)', + ], + 'action': [ + 'python', '<(DEPTH)/remoting/webapp/build-webapp.py', + '<(buildtype)', + '<(version_full)', + '<(output_dir)', + '<(zip_path)', + '<(ar_shared_module_manifest)', + 'shared_module', # Web app type + '<@(ar_shared_module_files)', + '--locales_listfile', + '<(ar_shared_module_locales_listfile)', + ], + }, + + { + 'action_name': 'Build ar_shared_module main.html', + 'inputs': [ + '<(DEPTH)/remoting/webapp/build-html.py', + '<(ar_main_template)', + '<@(ar_main_template_files)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html', + ], + 'action': [ + 'python', '<(DEPTH)/remoting/webapp/build-html.py', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html', + '<(ar_main_template)', + '--template-dir', + '<(DEPTH)/remoting', + '--templates', + '<@(ar_main_template_files)', + '--js', + '<@(ar_main_js_files)', + ], + }, + { + 'action_name': 'Build ar_shared_module ar_background.html', + 'inputs': [ + '<(DEPTH)/remoting/webapp/build-html.py', + '<(ar_background_template)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/ar_background.html', + ], + 'action': [ + 'python', '<(DEPTH)/remoting/webapp/build-html.py', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/ar_background.html', + '<(ar_background_template)', + '--template-dir', + '<(DEPTH)/remoting', + '--js', + '<@(ar_background_html_js_files)', + ], + }, + { + 'action_name': 'Build ar_shared_module wcs_sandbox.html', + 'inputs': [ + '<(DEPTH)/remoting/webapp/build-html.py', + '<(remoting_webapp_template_wcs_sandbox)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html', + ], + 'action': [ + 'python', '<(DEPTH)/remoting/webapp/build-html.py', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html', + '<(remoting_webapp_template_wcs_sandbox)', + '--js', + '<@(remoting_webapp_wcs_sandbox_html_all_js_files)', + ], + }, + { + 'action_name': 'Build ar_shared_module loading_window.html', + 'inputs': [ + '<(DEPTH)/remoting/webapp/build-html.py', + '<(ar_loading_window_template)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/loading_window.html', + ], + 'action': [ + 'python', '<(DEPTH)/remoting/webapp/build-html.py', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/loading_window.html', + '<(ar_loading_window_template)', + # The loading window is just a reskin of the message window--all + # JS code is shared. + '--js', '<@(remoting_webapp_message_window_html_all_js_files)', + ], + }, + { + 'action_name': 'Build ar_shared_module message_window.html', + 'inputs': [ + '<(DEPTH)/remoting/webapp/build-html.py', + '<(remoting_webapp_template_message_window)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/message_window.html', + ], + 'action': [ + 'python', '<(DEPTH)/remoting/webapp/build-html.py', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/message_window.html', + '<(remoting_webapp_template_message_window)', + '--js', '<@(remoting_webapp_message_window_html_all_js_files)', + ], + }, + { + 'action_name': 'Build ar_shared_module feedback_consent.html', + 'inputs': [ + '<(DEPTH)/remoting/webapp/build-html.py', + '<(ar_feedback_consent_template)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/feedback_consent.html', + ], + 'action': [ + 'python', '<(DEPTH)/remoting/webapp/build-html.py', + '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/feedback_consent.html', + '<(ar_feedback_consent_template)', + '--template-dir', + '<(DEPTH)/remoting', + '--js', + '<@(ar_feedback_consent_html_all_js_files)', + ], + }, + ], # actions + + + }, # end of ar_shared_module + + ], # end of targets +} diff --git a/remoting/app_remoting_webapp_build.gypi b/remoting/app_remoting_webapp_build.gypi index 9117e4f..01886d0 100644 --- a/remoting/app_remoting_webapp_build.gypi +++ b/remoting/app_remoting_webapp_build.gypi @@ -40,19 +40,10 @@ '>(ar_app_path)/icon128.png', '>(ar_app_path)/loading_splash.png', ], - 'ar_generated_html_files': [ - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/loading_window.html', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/message_window.html', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/feedback_consent.html', - '<(SHARED_INTERMEDIATE_DIR)/remoting/credits.html', - ], 'ar_webapp_files': [ '<@(ar_app_specific_files)', - '<@(ar_shared_resource_files)', - '<@(ar_all_js_files)', - '<@(ar_generated_html_files)', + '<@(ar_vendor_js_files)', + '<@(ar_vendor_html_files)', ], 'output_dir': '<(PRODUCT_DIR)/app_streaming/<@(ar_service_environment)/>(_target_name)', 'zip_path': '<(PRODUCT_DIR)/app_streaming/<@(ar_service_environment)/>(_target_name).zip', @@ -103,7 +94,6 @@ '<(remoting_version_path)', '<@(ar_webapp_files)', '<@(remoting_webapp_locale_files)', - '<@(ar_generated_html_files)', '<(ar_app_manifest_app)', '<(DEPTH)/remoting/<(ar_app_manifest_common)', '<(ar_webapp_locales_listfile)', @@ -140,98 +130,6 @@ '>@(_app_client_id)', ], }, - { - 'action_name': 'Build ">(ar_app_name)" main.html', - 'inputs': [ - '<(DEPTH)/remoting/webapp/build-html.py', - '<(ar_main_template)', - '<@(ar_main_template_files)', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html', - ], - 'action': [ - 'python', '<(DEPTH)/remoting/webapp/build-html.py', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/main.html', - '<(ar_main_template)', - '--template-dir', - '<(DEPTH)/remoting', - '--templates', - '<@(ar_main_template_files)', - '--js', - '<@(ar_main_js_files)', - ], - }, - { - 'action_name': 'Build ">(ar_app_name)" wcs_sandbox.html', - 'inputs': [ - '<(DEPTH)/remoting/webapp/build-html.py', - '<(remoting_webapp_template_wcs_sandbox)', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html', - ], - 'action': [ - 'python', '<(DEPTH)/remoting/webapp/build-html.py', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/wcs_sandbox.html', - '<(remoting_webapp_template_wcs_sandbox)', - '--js', - '<@(remoting_webapp_wcs_sandbox_html_all_js_files)', - ], - }, - { - 'action_name': 'Build ">(ar_app_name)" loading_window.html', - 'inputs': [ - '<(DEPTH)/remoting/webapp/build-html.py', - '<(ar_loading_window_template)', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/loading_window.html', - ], - 'action': [ - 'python', '<(DEPTH)/remoting/webapp/build-html.py', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/loading_window.html', - '<(ar_loading_window_template)', - # The loading window is just a reskin of the message window--all - # JS code is shared. - '--js', '<@(remoting_webapp_message_window_html_all_js_files)', - ], - }, - { - 'action_name': 'Build ">(ar_app_name)" message_window.html', - 'inputs': [ - '<(DEPTH)/remoting/webapp/build-html.py', - '<(remoting_webapp_template_message_window)', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/message_window.html', - ], - 'action': [ - 'python', '<(DEPTH)/remoting/webapp/build-html.py', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/message_window.html', - '<(remoting_webapp_template_message_window)', - '--js', '<@(remoting_webapp_message_window_html_all_js_files)', - ], - }, - { - 'action_name': 'Build ">(ar_app_name)" feedback_consent.html', - 'inputs': [ - '<(DEPTH)/remoting/webapp/build-html.py', - '<(ar_feedback_consent_template)', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/feedback_consent.html', - ], - 'action': [ - 'python', '<(DEPTH)/remoting/webapp/build-html.py', - '<(SHARED_INTERMEDIATE_DIR)/>(_target_name)/feedback_consent.html', - '<(ar_feedback_consent_template)', - '--template-dir', - '<(DEPTH)/remoting', - '--js', - '<@(ar_feedback_consent_html_all_js_files)', - ], - }, ], # actions 'conditions': [ ['buildtype == "Dev"', { diff --git a/remoting/app_remoting_webapp_compile.gypi b/remoting/app_remoting_webapp_compile.gypi index 4cc36d9..40946b5 100644 --- a/remoting/app_remoting_webapp_compile.gypi +++ b/remoting/app_remoting_webapp_compile.gypi @@ -23,7 +23,7 @@ 'target_name': 'verify_background.js', 'variables': { 'source_files': [ - '<@(ar_background_js_files)', + '<@(ar_background_html_js_files)', '<@(remoting_webapp_js_proto_files)', ], 'out_file': '<(PRODUCT_DIR)/>(_target_name)_background_jscompile.stamp', @@ -42,4 +42,4 @@ 'includes': ['compile_js.gypi'], }, ], # targets -}
\ No newline at end of file +} diff --git a/remoting/app_remoting_webapp_files.gypi b/remoting/app_remoting_webapp_files.gypi index 211593e..a4a25e7 100644 --- a/remoting/app_remoting_webapp_files.gypi +++ b/remoting/app_remoting_webapp_files.gypi @@ -57,7 +57,6 @@ 'webapp/app_remoting/js/app_remoting.js', 'webapp/app_remoting/js/app_remoting_activity.js', 'webapp/app_remoting/js/ar_auth_dialog.js', - 'webapp/app_remoting/js/ar_main.js', 'webapp/app_remoting/js/context_menu_adapter.js', 'webapp/app_remoting/js/context_menu_chrome.js', 'webapp/app_remoting/js/context_menu_dom.js', @@ -69,8 +68,6 @@ 'webapp/app_remoting/js/loading_window.js', 'webapp/app_remoting/js/submenu_manager.js', 'webapp/app_remoting/js/window_activation_menu.js', - 'webapp/base/js/application.js', - 'webapp/base/js/base.js', 'webapp/base/js/message_window_helper.js', 'webapp/base/js/message_window_manager.js', '<@(remoting_webapp_shared_js_auth_google_files)', @@ -82,18 +79,30 @@ '<@(remoting_webapp_shared_js_ui_files)', ], - 'ar_background_js_files': [ + # Variables for ar_background.html. + 'ar_background_template': + '<(DEPTH)/remoting/webapp/app_remoting/html/template_background.html', + 'ar_background_html_js_files': [ 'webapp/app_remoting/js/ar_background.js', 'webapp/base/js/platform.js', ], + 'ar_vendor_js_files': [ + 'webapp/app_remoting/vendor/arv_main.js', + ], + + 'ar_vendor_html_files': [ + 'webapp/app_remoting/vendor/arv_background.html', + 'webapp/app_remoting/vendor/arv_main.html', + 'webapp/app_remoting/vendor/arv_wcs_sandbox.html', + ], + 'ar_all_js_files': [ '<@(ar_main_js_files)', '<@(ar_feedback_consent_html_js_files)', '<@(remoting_webapp_message_window_html_js_files)', '<@(remoting_webapp_wcs_sandbox_html_js_files)', - # Referenced from the manifest. - '<@(ar_background_js_files)', + '<@(ar_background_html_js_files)', 'webapp/base/js/credits_js.js', ], diff --git a/remoting/remoting_all.gyp b/remoting/remoting_all.gyp index 2451f15..70adde6 100644 --- a/remoting/remoting_all.gyp +++ b/remoting/remoting_all.gyp @@ -13,6 +13,7 @@ 'type': 'none', 'dependencies': [ '../remoting/app_remoting_webapp.gyp:ar_sample_app', + '../remoting/app_remoting_shared_module.gyp:ar_shared_module', '../remoting/remoting.gyp:ar_sample_test_driver', '../remoting/remoting.gyp:chromoting_test_driver', '../remoting/remoting.gyp:remoting_base', diff --git a/remoting/remoting_options.gni b/remoting/remoting_options.gni index df1292f..6c1c7a1 100644 --- a/remoting/remoting_options.gni +++ b/remoting/remoting_options.gni @@ -11,6 +11,9 @@ declare_args() { # Set this to enable cast mode on the android client. enable_cast = 0 +# Set this to enable building internal AppRemoting apps. +enable_internal_app_remoting_targets = false + # Set this to use GCD instead of the remoting directory service. remoting_use_gcd = 0 diff --git a/remoting/remoting_webapp_files.gypi b/remoting/remoting_webapp_files.gypi index c7e1fdf..3b0cb9f 100644 --- a/remoting/remoting_webapp_files.gypi +++ b/remoting/remoting_webapp_files.gypi @@ -178,7 +178,6 @@ ], # Remoting core JavaScript files. 'remoting_webapp_shared_js_core_files': [ - 'webapp/base/js/app_capabilities.js', 'webapp/base/js/application.js', 'webapp/base/js/base.js', 'webapp/base/js/ipc.js', diff --git a/remoting/webapp/BUILD.gn b/remoting/webapp/BUILD.gn index 34d90e0..a152052 100644 --- a/remoting/webapp/BUILD.gn +++ b/remoting/webapp/BUILD.gn @@ -12,13 +12,42 @@ group("webapp") { ":webapp_v1", ":ar_sample_app", ":credits", + ":ar_shared_module", ] + if (enable_internal_app_remoting_targets) { + deps += [ "//remoting/internal:ar_internal_apps" ] + } + if (enable_nacl) { deps += [ ":webapp_v2" ] } } +# GYP version: remoting/remoting_client:remoting_credits +action("credits") { + about_credits_file = "$target_gen_dir/credits.html" + script = "//tools/licenses.py" + + inputs = [ + "base/html/credits.tmpl", + "base/html/credits_entry.tmpl", + ] + + outputs = [ + about_credits_file, + ] + + args = [ + "credits", + rebase_path(about_credits_file, root_build_dir), + "--file-template", + rebase_path("base/html/credits.tmpl", root_build_dir), + "--entry-template", + rebase_path("base/html/credits_entry.tmpl", root_build_dir), + ] +} + desktop_remoting_webapp("webapp_v1") { webapp_type = "v1" output_dir = "remoting/remoting-webapp" @@ -41,32 +70,15 @@ app_remoting_webapp("ar_sample_app") { app_key = "Sample_App" app_id = "ljacajndfccfgnfohlgkdphmbnpkjflk" app_client_id = "sample_client_id" - app_name = "App Remoting Client" + app_vendor = "" + app_name = "sample_app" + app_fullname = "App Remoting Client" app_description = "App Remoting client" app_capabilities = [ "GOOGLE_DRIVE" ] manifest_key = "remotingdevbuild" } -# GYP version: remoting/remoting_client:remoting_client_credits -action("credits") { - about_credits_file = "$target_gen_dir/credits.html" - script = "//tools/licenses.py" - - inputs = [ - "base/html/credits.tmpl", - "base/html/credits_entry.tmpl", - ] - - outputs = [ - about_credits_file, - ] - - args = [ - "credits", - rebase_path(about_credits_file, root_build_dir), - "--file-template", - rebase_path("base/html/credits.tmpl", root_build_dir), - "--entry-template", - rebase_path("base/html/credits_entry.tmpl", root_build_dir), - ] +app_remoting_shared_module("ar_shared_module") { + #app_client_id = "sample_client_id" + app_name = "shared_module" } diff --git a/remoting/webapp/app_remoting/html/context_menu.html b/remoting/webapp/app_remoting/html/context_menu.html index ebc056e..010c86d 100644 --- a/remoting/webapp/app_remoting/html/context_menu.html +++ b/remoting/webapp/app_remoting/html/context_menu.html @@ -6,7 +6,7 @@ found in the LICENSE file. <div id="context-menu" draggable="true" hidden> <div class="no-gaps"> - <img src="icon48.png" class="context-menu-icon"> + <img src="/icon48.png" class="context-menu-icon"> <span class="context-menu-stub etched"></span> </div> <ul> diff --git a/remoting/webapp/app_remoting/html/template_background.html b/remoting/webapp/app_remoting/html/template_background.html new file mode 100644 index 0000000..10d293b --- /dev/null +++ b/remoting/webapp/app_remoting/html/template_background.html @@ -0,0 +1,18 @@ +<!doctype html> +<!-- +Copyright 2015 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. +--> + +<html> + <head> + <meta charset="utf-8"> + + <meta-include type="javascript"/> + + <title></title> + </head> + <body> + </body> +</html> diff --git a/remoting/webapp/app_remoting/html/template_feedback_consent.html b/remoting/webapp/app_remoting/html/template_feedback_consent.html index 6fc98d8..4d839e4 100644 --- a/remoting/webapp/app_remoting/html/template_feedback_consent.html +++ b/remoting/webapp/app_remoting/html/template_feedback_consent.html @@ -8,7 +8,7 @@ found in the LICENSE file. <html> <head> <meta charset="utf-8"> - <link rel="icon" type="image/png" href="icon16.png"> + <link rel="icon" type="image/png" href="/icon16.png"> <link rel="stylesheet" href="open_sans.css"> <link rel="stylesheet" href="feedback_consent.css"> <link rel="stylesheet" href="main.css"> diff --git a/remoting/webapp/app_remoting/html/template_lg.html b/remoting/webapp/app_remoting/html/template_lg.html index 6f27a94..18aa95e 100644 --- a/remoting/webapp/app_remoting/html/template_lg.html +++ b/remoting/webapp/app_remoting/html/template_lg.html @@ -8,7 +8,7 @@ found in the LICENSE file. <html class="full-height app-remoting"> <head> <meta charset="utf-8"> - <link rel="icon" type="image/png" href="icon16.png"> + <link rel="icon" type="image/png" href="/icon16.png"> <link rel="stylesheet" href="ar_main.css"> <link rel="stylesheet" href="ar_dialog.css"> <link rel="stylesheet" href="connection_stats.css"> @@ -19,6 +19,8 @@ found in the LICENSE file. <meta-include type="javascript"/> + <link rel="import" href="/arv_main.html"> + <title i18n-content="PRODUCT_NAME_APP_STREAMING"></title> </head> diff --git a/remoting/webapp/app_remoting/html/template_loading_window.html b/remoting/webapp/app_remoting/html/template_loading_window.html index b69432e..713e798 100644 --- a/remoting/webapp/app_remoting/html/template_loading_window.html +++ b/remoting/webapp/app_remoting/html/template_loading_window.html @@ -17,7 +17,7 @@ found in the LICENSE file. <title></title> </head> <body> - <img src="loading_splash.png" id="splash-image"> + <img src="/loading_splash.png" id="splash-image"> <div class="message-container"> <div id="title" hidden></div> <p id="infobox" class="information-box"></p> diff --git a/remoting/webapp/app_remoting/js/app_remoting.js b/remoting/webapp/app_remoting/js/app_remoting.js index 359370d..92c0c6e 100644 --- a/remoting/webapp/app_remoting/js/app_remoting.js +++ b/remoting/webapp/app_remoting/js/app_remoting.js @@ -14,25 +14,60 @@ var remoting = remoting || {}; /** - * @param {Array<string>} appCapabilities Array of application capabilities. - * @param {remoting.LicenseManager=} opt_licenseManager + * Parameters for the remoting.AppRemoting constructor. + * + * appId: The application ID. If this is not specified than the app id will + * be extracted from the app's manifest. + * + * appCapabilites: Array of application capabilites. + * + * licenseManager: Licence manager for this application. + * + * @typedef {{ + * appId: (string|undefined), + * appCapabilities: (Array<string>|undefined), + * licenseManager: (remoting.LicenseManager|undefined) + * }} + */ +remoting.AppRemotingParams; + +/** + * @param {remoting.AppRemotingParams} args * @constructor * @implements {remoting.ApplicationInterface} * @extends {remoting.Application} */ -remoting.AppRemoting = function(appCapabilities, opt_licenseManager) { +remoting.AppRemoting = function(args) { base.inherits(this, remoting.Application); + remoting.app = this; /** @private {remoting.Activity} */ this.activity_ = null; + /** @private {string} */ + this.appId_ = (args.appId) ? args.appId : chrome.runtime.id; + /** @private */ - this.licenseManager_ = (opt_licenseManager) ? - opt_licenseManager : + this.licenseManager_ = (args.licenseManager) ? + args.licenseManager : new remoting.GaiaLicenseManager(); /** @private */ - this.appCapabilities_ = appCapabilities; + this.appCapabilities_ = (args.appCapabilities) ? args.appCapabilities : []; + + // This prefix must be added to message window paths so that the HTML + // files can be found in the shared module. + // TODO(garykac) Add support for dev/prod shared modules. + remoting.MessageWindow.htmlFilePrefix = + "_modules/koejkfhmphamcgafjmkellhnekdkopod/"; +}; + +/** + * @return {string} Application Id. + * @override {remoting.ApplicationInterface} + */ +remoting.AppRemoting.prototype.getApplicationId = function() { + return this.appId_; }; /** diff --git a/remoting/webapp/app_remoting/js/app_remoting_activity.js b/remoting/webapp/app_remoting/js/app_remoting_activity.js index a14e916..0abc1dd 100644 --- a/remoting/webapp/app_remoting/js/app_remoting_activity.js +++ b/remoting/webapp/app_remoting/js/app_remoting_activity.js @@ -94,7 +94,7 @@ remoting.AppRemotingActivity.prototype.cleanup_ = function() { */ remoting.AppRemotingActivity.prototype.getAppHostInfo_ = function(token) { var url = remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + - remoting.settings.getAppRemotingApplicationId() + '/run'; + this.app_.getApplicationId() + '/run'; // TODO(kelvinp): Passes |this.subscriptionToken_| to the XHR. return new remoting.AutoRetryXhr({ method: 'POST', diff --git a/remoting/webapp/app_remoting/js/application_context_menu.js b/remoting/webapp/app_remoting/js/application_context_menu.js index 26051a0..74b96cc 100644 --- a/remoting/webapp/app_remoting/js/application_context_menu.js +++ b/remoting/webapp/app_remoting/js/application_context_menu.js @@ -107,6 +107,7 @@ remoting.ApplicationContextMenu.prototype.onClicked_ = function(info) { var onLoad = function() { var message = { method: 'init', + appId: remoting.app.getApplicationId(), hostId: that.hostId_, connectionStats: JSON.stringify(that.stats_.mostRecent()), sessionId: that.clientSession_.getLogger().getSessionId() diff --git a/remoting/webapp/app_remoting/js/ar_background.js b/remoting/webapp/app_remoting/js/ar_background.js index 4ee2507..d9ea8e5 100644 --- a/remoting/webapp/app_remoting/js/ar_background.js +++ b/remoting/webapp/app_remoting/js/ar_background.js @@ -55,7 +55,10 @@ function createWindow(opt_launchData) { appWindow.onClosed.addListener(onClosed); }; - chrome.app.window.create('main.html', windowAttributes, onCreate); + // TODO(garykac) Add code to switch between dev and prod shared modules. + chrome.app.window.create( + '_modules/koejkfhmphamcgafjmkellhnekdkopod/main.html', + windowAttributes, onCreate); }; /** @param {Event} event */ diff --git a/remoting/webapp/app_remoting/js/feedback_consent.js b/remoting/webapp/app_remoting/js/feedback_consent.js index bbe06c4..8bfd9ec 100644 --- a/remoting/webapp/app_remoting/js/feedback_consent.js +++ b/remoting/webapp/app_remoting/js/feedback_consent.js @@ -5,6 +5,11 @@ 'use strict'; /** + * @type {string} The app id (from the webstore) for this application. + */ +var appId = ''; + +/** * @type {string} The host id corresponding to the user's VM. The @pending * place-holder instructs the Orchestrator to abandon any pending host, * and is used if no host id is provided by the main window. @@ -140,7 +145,7 @@ function onToken(token) { 'crashServiceReportId': crashServiceReportId }; var uri = remoting.settings.APP_REMOTING_API_BASE_URL + - '/applications/' + remoting.settings.getAppRemotingApplicationId() + + '/applications/' + appId + '/hosts/' + hostId + '/reportIssue'; var onDone = function(/** !remoting.Xhr.Response */ response) { @@ -252,6 +257,7 @@ function onWindowMessage(event) { if (event.data['hostId']) { hostId = /** @type {string} */ (event.data['hostId']); } + appId = /** @type {string} */ (event.data['appId']); connectionStats = /** @type {string} */ (event.data['connectionStats']); sessionId = /** @type {string} */ (event.data['sessionId']); } diff --git a/remoting/webapp/app_remoting/manifest_common.json.jinja2 b/remoting/webapp/app_remoting/manifest_common.json.jinja2 index ea7ed0d..a1f87b8 100644 --- a/remoting/webapp/app_remoting/manifest_common.json.jinja2 +++ b/remoting/webapp/app_remoting/manifest_common.json.jinja2 @@ -6,9 +6,13 @@ "default_locale": "en", "app": { "background": { - "scripts": ["ar_background.js", "platform.js"] + "page": "arv_background.html" } }, + "import": [{ + "id": "koejkfhmphamcgafjmkellhnekdkopod" + } + ], "icons": { "128": "icon128.png", "48": "icon48.png", @@ -59,5 +63,5 @@ ] }, "sandbox": { - "pages": [ "wcs_sandbox.html" ] + "pages": [ "arv_wcs_sandbox.html" ] } diff --git a/remoting/webapp/app_remoting/shared_module/manifest.json b/remoting/webapp/app_remoting/shared_module/manifest.json new file mode 100644 index 0000000..7ac5731 --- /dev/null +++ b/remoting/webapp/app_remoting/shared_module/manifest.json @@ -0,0 +1,8 @@ +{ + "name": "AppRemoting Shared Module", + "manifest_version": 2, + "version": "1.0", + "export": {}, + "default_locale": "en", + "key": "AppRemotingSharedMod" +} diff --git a/remoting/webapp/app_remoting/vendor/arv_background.html b/remoting/webapp/app_remoting/vendor/arv_background.html new file mode 100644 index 0000000..85c419e --- /dev/null +++ b/remoting/webapp/app_remoting/vendor/arv_background.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<iframe src="_modules/koejkfhmphamcgafjmkellhnekdkopod/ar_background.html"></iframe> diff --git a/remoting/webapp/app_remoting/vendor/arv_main.html b/remoting/webapp/app_remoting/vendor/arv_main.html new file mode 100644 index 0000000..0b655f8 --- /dev/null +++ b/remoting/webapp/app_remoting/vendor/arv_main.html @@ -0,0 +1,13 @@ +<!doctype html> +<!-- +Copyright 2015 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. +--> + +<!-- +This file is automatically HTML-imported by the main HTML page. +Multiple JS files can be listed here and they will all be included in the +app's main HTML page. +--> +<script src="arv_main.js"></script> diff --git a/remoting/webapp/app_remoting/js/ar_main.js b/remoting/webapp/app_remoting/vendor/arv_main.js index 2efe129..d2333dd 100644 --- a/remoting/webapp/app_remoting/js/ar_main.js +++ b/remoting/webapp/app_remoting/vendor/arv_main.js @@ -11,8 +11,17 @@ var remoting = remoting || {}; * Entry point ('load' handler) for App Remoting webapp. */ remoting.startAppRemoting = function() { - remoting.app = new remoting.AppRemoting(remoting.app_capabilities()); - remoting.app.start(); + var options = { + // This string is overwritten with the actual app id by the build script. + appId: 'APP_REMOTING_APPLICATION_ID', + + // This string is overwritten with the actual capabilities required by + // this application. + appCapabilities: ['APPLICATION_CAPABILITIES'], + }; + + var app = new remoting.AppRemoting(options); + app.start(); }; window.addEventListener('load', remoting.startAppRemoting, false); diff --git a/remoting/webapp/app_remoting/vendor/arv_wcs_sandbox.html b/remoting/webapp/app_remoting/vendor/arv_wcs_sandbox.html new file mode 100644 index 0000000..cdca40a --- /dev/null +++ b/remoting/webapp/app_remoting/vendor/arv_wcs_sandbox.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<iframe src="_modules/koejkfhmphamcgafjmkellhnekdkopod/wcs_sandbox.html"></iframe> diff --git a/remoting/webapp/base/js/app_capabilities.js b/remoting/webapp/base/js/app_capabilities.js deleted file mode 100644 index bdbc96c..0000000 --- a/remoting/webapp/base/js/app_capabilities.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 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'; - -/** @suppress {duplicate} */ -var remoting = remoting || {}; - -/** - * Note that this needs to be a function because it gets expanded at - * compile-time into remoting.ClientSession.Capability enums and these - * are not guaranteed to be present yet when this file is loaded. - * @return {Array<remoting.ClientSession.Capability>} - */ -remoting.app_capabilities = function() { - return ['APPLICATION_CAPABILITIES']; -} diff --git a/remoting/webapp/base/js/application.js b/remoting/webapp/base/js/application.js index b9bbb18..d1b1530 100644 --- a/remoting/webapp/base/js/application.js +++ b/remoting/webapp/base/js/application.js @@ -119,6 +119,11 @@ remoting.Application.prototype.getExtensionInfo = function() { */ /** @return {string} */ +remoting.Application.prototype.getApplicationId = function() { + console.assert(false, 'Subclass must override'); +}; + +/** @return {string} */ remoting.Application.prototype.getApplicationName = function() { console.assert(false, 'Subclass must override getApplicationName().'); }; @@ -165,6 +170,11 @@ remoting.Application.prototype.exitApplication_ = function() { remoting.ApplicationInterface = function() {}; /** + * @return {string} Application Id. + */ +remoting.ApplicationInterface.prototype.getApplicationId = function() {}; + +/** * @return {string} Application product name to be used in UI. */ remoting.ApplicationInterface.prototype.getApplicationName = function() {}; diff --git a/remoting/webapp/base/js/message_window_helper.js b/remoting/webapp/base/js/message_window_helper.js index 17200d3..936f9a7 100644 --- a/remoting/webapp/base/js/message_window_helper.js +++ b/remoting/webapp/base/js/message_window_helper.js @@ -121,7 +121,9 @@ remoting.MessageWindow = function(options) { }; var htmlFile = options.htmlFile || 'message_window.html'; - chrome.app.window.create(htmlFile, windowAttributes, onCreate); + chrome.app.window.create( + remoting.MessageWindow.htmlFilePrefix + htmlFile, + windowAttributes, onCreate); if (duration != 0) { this.timer_ = window.setTimeout(this.onTimeoutHandler_.bind(this), @@ -130,6 +132,15 @@ remoting.MessageWindow = function(options) { }; /** + * This string is prepended to the htmlFile when message windows are created. + * Normally, this should be left empty, but the shared module needs to specify + * this so that the shared HTML files can be found when running in the + * context of the app stub. + * @type {string} + */ +remoting.MessageWindow.htmlFilePrefix = ""; + +/** * Called when the timer runs out. This in turn calls the window's * timeout handler (if any). */ diff --git a/remoting/webapp/base/js/plugin_settings.js b/remoting/webapp/base/js/plugin_settings.js index 05a9447..0131bc1 100644 --- a/remoting/webapp/base/js/plugin_settings.js +++ b/remoting/webapp/base/js/plugin_settings.js @@ -51,18 +51,6 @@ remoting.Settings.prototype.OAUTH2_REDIRECT_URL = function() { remoting.Settings.prototype.APP_REMOTING_API_BASE_URL = 'APP_REMOTING_API_BASE_URL'; -/** - * Return this app's Application ID. - * - * This is a function rather than a constant because the build script may - * replace this string with code to calculate the app id dynamically. - * - * @return {string} The Application ID. - */ -remoting.Settings.prototype.getAppRemotingApplicationId = function() { - return 'APP_REMOTING_APPLICATION_ID'; -}; - /** @type {string} XMPP JID for the remoting directory server bot. */ remoting.Settings.prototype.DIRECTORY_BOT_JID = 'DIRECTORY_BOT_JID'; diff --git a/remoting/webapp/build-webapp.py b/remoting/webapp/build-webapp.py index ac4a2e0..da7e516 100755 --- a/remoting/webapp/build-webapp.py +++ b/remoting/webapp/build-webapp.py @@ -120,7 +120,9 @@ def buildWebApp(buildtype, version, destination, zip_path, zipfile: A string with path to the zipfile to create containing the contents of |destination|. manifest_template: jinja2 template file for manifest. - webapp_type: webapp type ("v1", "v2", "v2_pnacl" or "app_remoting"). + webapp_type: webapp type: + For DesktopRemoting: "v1", "v2" or "v2_pnacl" + For AppRemoting: "app_remoting" or "shared_module" appid: A string with the Remoting Application Id (only used for app remoting webapps). If supplied, it defaults to using the test API server. @@ -212,11 +214,20 @@ def buildWebApp(buildtype, version, destination, zip_path, else: raise Exception('Unknown extension: ' + current_locale) + is_app_remoting_webapp = webapp_type == 'app_remoting' + is_app_remoting_shared_module = webapp_type == 'shared_module' + is_app_remoting = is_app_remoting_webapp or is_app_remoting_shared_module + is_prod_service_environment = service_environment == 'vendor' or \ + service_environment == 'prod' or \ + service_environment == 'prod-testing' + is_desktop_remoting = not is_app_remoting + # Set client plugin type. # TODO(wez): Use 'native' in app_remoting until b/17441659 is resolved. - client_plugin = 'pnacl' if webapp_type == 'v2_pnacl' else 'native' - findAndReplace(os.path.join(destination, 'plugin_settings.js'), - "'CLIENT_PLUGIN_TYPE'", "'" + client_plugin + "'") + if not is_app_remoting_webapp: + client_plugin = 'pnacl' if webapp_type == 'v2_pnacl' else 'native' + findAndReplace(os.path.join(destination, 'plugin_settings.js'), + "'CLIENT_PLUGIN_TYPE'", "'" + client_plugin + "'") # Allow host names for google services/apis to be overriden via env vars. oauth2AccountsHost = os.environ.get( @@ -228,13 +239,11 @@ def buildWebApp(buildtype, version, destination, zip_path, remotingApiHost = os.environ.get( 'REMOTING_API_HOST', 'https://remoting-pa.googleapis.com') - is_app_remoting_webapp = webapp_type == 'app_remoting' - is_prod_service_environment = service_environment == 'vendor' or \ - service_environment == 'prod' or \ - service_environment == 'prod-testing' - if is_app_remoting_webapp: + if is_app_remoting: appRemotingApiHost = os.environ.get( 'APP_REMOTING_API_HOST', None) + + if is_app_remoting_webapp: appRemotingApplicationId = os.environ.get( 'APP_REMOTING_APPLICATION_ID', None) @@ -267,7 +276,7 @@ def buildWebApp(buildtype, version, destination, zip_path, appRemotingApplicationId = "'" + effectiveAppId + "'" else: appRemotingApplicationId = "chrome.i18n.getMessage('@@extension_id')" - findAndReplace(os.path.join(destination, 'plugin_settings.js'), + findAndReplace(os.path.join(destination, 'arv_main.js'), "'APP_REMOTING_APPLICATION_ID'", appRemotingApplicationId) oauth2BaseUrl = oauth2AccountsHost + '/o/oauth2' @@ -275,7 +284,7 @@ def buildWebApp(buildtype, version, destination, zip_path, directoryApiBaseUrl = directoryApiHost + '/chromoting/v1' telemetryApiBaseUrl = remotingApiHost + '/v1/events' - if is_app_remoting_webapp: + if is_app_remoting: # Set the apiary endpoint and then set the endpoint version if not appRemotingApiHost: if is_prod_service_environment: @@ -283,7 +292,11 @@ def buildWebApp(buildtype, version, destination, zip_path, else: appRemotingApiHost = 'https://www-googleapis-test.sandbox.google.com' - if service_environment == 'dev': + # TODO(garykac) Currently, the shared module is always set up for the + # dev service_environment. Update build so that the dev environment can + # be controlled by the app stub rather than hard-coded into the shared + # module. + if service_environment == 'dev' or is_app_remoting_shared_module: appRemotingServicePath = '/appremoting/v1beta1_dev' elif service_environment == 'test': appRemotingServicePath = '/appremoting/v1beta1' @@ -301,14 +314,18 @@ def buildWebApp(buildtype, version, destination, zip_path, else: appRemotingApiBaseUrl = '' - replaceBool(destination, 'USE_GCD', use_gcd) - replaceString(destination, 'OAUTH2_BASE_URL', oauth2BaseUrl) - replaceString(destination, 'OAUTH2_API_BASE_URL', oauth2ApiBaseUrl) - replaceString(destination, 'DIRECTORY_API_BASE_URL', directoryApiBaseUrl) - replaceString(destination, 'TELEMETRY_API_BASE_URL', telemetryApiBaseUrl) - if is_app_remoting_webapp: - replaceString(destination, 'APP_REMOTING_API_BASE_URL', - appRemotingApiBaseUrl) + # TODO(garykac) replaceString (et al.) implictly update plugin_settings.js, + # which doesn't exist for the app stub. We need to move app-specific + # AppRemoting options into arv_main.js. + if not is_app_remoting_webapp: + replaceBool(destination, 'USE_GCD', use_gcd) + replaceString(destination, 'OAUTH2_BASE_URL', oauth2BaseUrl) + replaceString(destination, 'OAUTH2_API_BASE_URL', oauth2ApiBaseUrl) + replaceString(destination, 'DIRECTORY_API_BASE_URL', directoryApiBaseUrl) + replaceString(destination, 'TELEMETRY_API_BASE_URL', telemetryApiBaseUrl) + if is_app_remoting: + replaceString(destination, 'APP_REMOTING_API_BASE_URL', + appRemotingApiBaseUrl) # Substitute hosts in the manifest's CSP list. # Ensure we list the API host only once if it's the same for multiple APIs. @@ -346,21 +363,23 @@ def buildWebApp(buildtype, version, destination, zip_path, oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/dev*' thirdPartyAuthUrlJs = oauth2RedirectBaseUrlJs + '/thirdpartyauth' thirdPartyAuthUrlJson = oauth2RedirectBaseUrlJson + '/thirdpartyauth*' - replaceString(destination, 'TALK_GADGET_URL', talkGadgetBaseUrl) - findAndReplace(os.path.join(destination, 'plugin_settings.js'), - "'OAUTH2_REDIRECT_URL'", oauth2RedirectUrlJs) - - # Configure xmpp server and directory bot settings in the plugin. - replaceBool( - destination, 'XMPP_SERVER_USE_TLS', - getenvBool('XMPP_SERVER_USE_TLS', True)) xmppServer = os.environ.get('XMPP_SERVER', 'talk.google.com:443') - replaceString(destination, 'XMPP_SERVER', xmppServer) - replaceString(destination, 'DIRECTORY_BOT_JID', - os.environ.get('DIRECTORY_BOT_JID', - 'remoting@bot.talk.google.com')) - replaceString(destination, 'THIRD_PARTY_AUTH_REDIRECT_URL', - thirdPartyAuthUrlJs) + + if not is_app_remoting_webapp: + replaceString(destination, 'TALK_GADGET_URL', talkGadgetBaseUrl) + findAndReplace(os.path.join(destination, 'plugin_settings.js'), + "'OAUTH2_REDIRECT_URL'", oauth2RedirectUrlJs) + + # Configure xmpp server and directory bot settings in the plugin. + replaceBool( + destination, 'XMPP_SERVER_USE_TLS', + getenvBool('XMPP_SERVER_USE_TLS', True)) + replaceString(destination, 'XMPP_SERVER', xmppServer) + replaceString(destination, 'DIRECTORY_BOT_JID', + os.environ.get('DIRECTORY_BOT_JID', + 'remoting@bot.talk.google.com')) + replaceString(destination, 'THIRD_PARTY_AUTH_REDIRECT_URL', + thirdPartyAuthUrlJs) # Set the correct API keys. # For overriding the client ID/secret via env vars, see google_api_keys.py. @@ -376,15 +395,17 @@ def buildWebApp(buildtype, version, destination, zip_path, else: apiClientIdV2 = google_api_keys.GetClientID('REMOTING_IDENTITY_API') - replaceString(destination, 'API_CLIENT_ID', apiClientId) - replaceString(destination, 'API_CLIENT_SECRET', apiClientSecret) - replaceString(destination, 'API_KEY', apiKey) + if not is_app_remoting_webapp: + replaceString(destination, 'API_CLIENT_ID', apiClientId) + replaceString(destination, 'API_CLIENT_SECRET', apiClientSecret) + replaceString(destination, 'API_KEY', apiKey) # Write the application capabilities. - appCapabilities = ','.join( - ['remoting.ClientSession.Capability.' + x for x in app_capabilities]) - findAndReplace(os.path.join(destination, 'app_capabilities.js'), - "'APPLICATION_CAPABILITIES'", appCapabilities) + if is_app_remoting_webapp: + appCapabilities = ','.join( + ['remoting.ClientSession.Capability.' + x for x in app_capabilities]) + findAndReplace(os.path.join(destination, 'arv_main.js'), + "'APPLICATION_CAPABILITIES'", appCapabilities) # Use a consistent extension id for dev builds. # AppRemoting builds always use the dev app id - the correct app id gets diff --git a/remoting/webapp/build_template.gni b/remoting/webapp/build_template.gni index 18991ef6..ecac04d 100644 --- a/remoting/webapp/build_template.gni +++ b/remoting/webapp/build_template.gni @@ -88,7 +88,7 @@ template("build_webapp_html") { js_files = invoker.js_files html_output = invoker.html_output - script = "build-html.py" + script = rebase_path("//remoting/webapp/build-html.py", root_build_dir) inputs = [ html_template_file ] + html_template_include_files + js_files @@ -165,17 +165,25 @@ template("desktop_remoting_webapp") { } action(target_name) { - script = "build-webapp.py" + script = "//remoting/webapp/build-webapp.py" webapp_type = invoker.webapp_type output_dir = invoker.output_dir zip_path = invoker.zip_path extra_files = invoker.extra_files - inputs = - [ rebase_path("crd/manifest.json.jinja2", root_build_dir) ] + - remoting_version_files + - rebase_path(remoting_webapp_crd_files, root_build_dir) + extra_files + dr_generated_html_files = [ + background_html_output, + message_window_html_output, + wcs_sandbox_html_output, + main_html_output, + "$target_gen_dir/credits.html", + ] + + inputs = [ rebase_path("crd/manifest.json.jinja2", root_build_dir) ] + + remoting_version_files + + rebase_path(remoting_webapp_crd_files, root_build_dir) + + extra_files + dr_generated_html_files outputs = [ "$target_gen_dir/$zip_path", @@ -188,14 +196,7 @@ template("desktop_remoting_webapp") { ":$wcs_sandbox_html", ":$main_html", "//remoting/resources", - ] - - dr_generated_html_files = [ - background_html_output, - message_window_html_output, - wcs_sandbox_html_output, - main_html_output, - "$target_gen_dir/credits.html", + "//remoting/webapp:credits", ] # Create a file that contains a list of all the resource files needed @@ -236,6 +237,138 @@ template("app_remoting_webapp") { locales_listfile_output = "$target_gen_dir/${target_name}_locales.txt" build_locales_listfile(locales_listfile) { + # TODO(garykac) Replace resources with empty stub rather than duplicating + # all the resources needed by the shared module. + # Template uses locales_listfile_output from outer scope. + } + + action(target_name) { + script = "//remoting/webapp/build-webapp.py" + + app_key = invoker.app_key + app_id = invoker.app_id + app_client_id = invoker.app_client_id + app_vendor = invoker.app_vendor + app_name = invoker.app_name + app_fullname = invoker.app_fullname + app_description = invoker.app_description + app_capabilities = invoker.app_capabilities + manifest_key = invoker.manifest_key + + # These asserts are so that these variables get marked as being used so + # that GN doesn't complain about them. + assert(app_key != "" || app_key == "") + assert(app_id != "" || app_id == "") + + ar_base_path = "//remoting/webapp/app_remoting" + if (app_vendor != "") { + ar_app_path = "$ar_base_path/internal/apps/$app_vendor/$app_name" + } else { + ar_app_path = "$ar_base_path/apps/$app_name" + } + ar_app_manifest = "$ar_app_path/manifest.json.jinja2" + ar_app_manifest_common = "$ar_base_path/manifest_common.json.jinja2" + + output_dir = "remoting/app_remoting/$ar_service_environment/$target_name" + zip_path = "remoting/app_remoting/$ar_service_environment/$target_name.zip" + + # TODO(garykac) Move this list of files into files.gni. + ar_app_specific_files = [ + "$ar_app_path/icon16.png", + "$ar_app_path/icon48.png", + "$ar_app_path/icon128.png", + "$ar_app_path/loading_splash.png", + ] + + ar_webapp_files = + ar_app_specific_files + ar_vendor_js_files + ar_vendor_html_files + + inputs = [ + rebase_path(ar_app_manifest, root_build_dir), + rebase_path(ar_app_manifest_common, root_build_dir), + ] + remoting_version_files + ar_webapp_files + + outputs = [ + "$target_gen_dir/$zip_path", + ] + + deps = [ + ":$locales_listfile", + "//remoting/resources", + ] + + # Create a file that contains a list of all the resource files needed + # to build the webapp. This is needed to avoid problems on platforms that + # limit the size of a command line. + file_list = "$target_gen_dir/${target_name}_files.txt" + files = [] + files += rebase_path(ar_webapp_files, root_build_dir) + write_file(file_list, files) + + args = [ + buildtype, + version_full, + output_dir, + zip_path, + rebase_path(ar_app_manifest, root_build_dir), + "app_remoting", # Web app type + ] + args += [ + "--files_listfile", + rebase_path(file_list, root_build_dir), + ] + args += [ + "--locales_listfile", + rebase_path(locales_listfile_output, root_build_dir), + ] + args += [ + "--jinja_paths", + rebase_path("//remoting/webapp/app_remoting", root_build_dir), + ] + + if (is_debug) { + # Normally, the app-id for the orchestrator is automatically extracted + # from the webapp's extension id, but that approach doesn't work for + # dev webapp builds (since they all share the same dev extension id). + # The --appid arg will create a webapp that registers the given app-id + # rather than using the extension id. + # This is only done for Dev apps because the app-id for Release apps + # *must* match the extension id. + args += [ + "--appid", + app_id, + ] + } + + args += [ + "--app_name", + app_fullname, + ] + args += [ + "--app_description", + app_description, + ] + args += [ "--app_capabilities" ] + app_capabilities + args += [ + "--service_environment", + ar_service_environment, + ] + args += [ + "--manifest_key", + manifest_key, + ] + args += [ + "--app_client_id", + app_client_id, + ] + } +} + +template("app_remoting_shared_module") { + locales_listfile = target_name + "_locales" + locales_listfile_output = "$target_gen_dir/${target_name}_locales.txt" + + build_locales_listfile(locales_listfile) { # Template uses locales_listfile_output from outer scope. } @@ -285,6 +418,17 @@ template("app_remoting_webapp") { html_output = wcs_sandbox_html_output } + background_html = target_name + "_background_html" + background_html_output = + "$target_gen_dir/html/$target_name/ar_background.html" + + build_webapp_html(background_html) { + html_template_file = ar_background_template + html_template_include_files = [] + js_files = ar_background_html_js_files + html_output = background_html_output + } + main_html = target_name + "_main_html" main_html_output = "$target_gen_dir/html/$target_name/main.html" @@ -298,37 +442,16 @@ template("app_remoting_webapp") { action(target_name) { script = "build-webapp.py" - app_key = invoker.app_key - app_id = invoker.app_id - app_client_id = invoker.app_client_id app_name = invoker.app_name - app_description = invoker.app_description - app_capabilities = invoker.app_capabilities - manifest_key = invoker.manifest_key - # These asserts are so that these variables get marked as being used so - # that GN doesn't complain about them. - assert(app_key != "" || app_key == "") - assert(app_id != "" || app_id == "") + ar_path = "app_remoting/$app_name" + ar_manifest = "$ar_path/manifest.json" - # TODO(garykac) For internal targets, we need to extract the vendor and app - # name from the target. - ar_app_name = "sample_app" #target_name - ar_app_path = "app_remoting/apps/$ar_app_name" - ar_app_manifest = "$ar_app_path/manifest.json.jinja2" - ar_app_manifest_common = "app_remoting/manifest_common.json.jinja2" - - output_dir = "remoting/app_remoting/$ar_service_environment/$target_name" - zip_path = "remoting/app_remoting/$ar_service_environment/$target_name.zip" - - ar_app_specific_files = [ - "$ar_app_path/icon16.png", - "$ar_app_path/icon48.png", - "$ar_app_path/icon128.png", - "$ar_app_path/loading_splash.png", - ] + output_dir = "remoting/app_remoting/$target_name" + zip_path = "remoting/app_remoting/$target_name.zip" ar_generated_html_files = [ + background_html_output, feedback_consent_html_output, loading_window_html_output, message_window_html_output, @@ -338,12 +461,10 @@ template("app_remoting_webapp") { ] ar_webapp_files = - ar_app_specific_files + ar_shared_resource_files + ar_all_js_files + ar_shared_resource_files + ar_all_js_files + ar_generated_html_files - inputs = [ - rebase_path(ar_app_manifest, root_build_dir), - rebase_path(ar_app_manifest_common, root_build_dir), - ] + remoting_version_files + ar_webapp_files + inputs = [ rebase_path(ar_manifest, root_build_dir) ] + + remoting_version_files + ar_webapp_files outputs = [ "$target_gen_dir/$zip_path", @@ -351,12 +472,14 @@ template("app_remoting_webapp") { deps = [ ":$locales_listfile", + ":$background_html", ":$feedback_consent_html", ":$loading_window_html", ":$message_window_html", ":$wcs_sandbox_html", ":$main_html", "//remoting/resources", + "//remoting/webapp:credits", ] # Create a file that contains a list of all the resource files needed @@ -364,7 +487,6 @@ template("app_remoting_webapp") { # limit the size of a command line. file_list = "$target_gen_dir/${target_name}_files.txt" files = [] - files += rebase_path(ar_generated_html_files, root_build_dir) files += rebase_path(ar_webapp_files, root_build_dir) write_file(file_list, files) @@ -373,8 +495,8 @@ template("app_remoting_webapp") { version_full, output_dir, zip_path, - rebase_path(ar_app_manifest, root_build_dir), - "app_remoting", # Web app type + rebase_path(ar_manifest, root_build_dir), + "shared_module", # Web app type ] args += [ "--files_listfile", @@ -384,45 +506,5 @@ template("app_remoting_webapp") { "--locales_listfile", rebase_path(locales_listfile_output, root_build_dir), ] - args += [ - "--jinja_paths", - rebase_path("app_remoting", root_build_dir), - ] - - if (is_debug) { - # Normally, the app-id for the orchestrator is automatically extracted - # from the webapp's extension id, but that approach doesn't work for - # dev webapp builds (since they all share the same dev extension id). - # The --appid arg will create a webapp that registers the given app-id - # rather than using the extension id. - # This is only done for Dev apps because the app-id for Release apps - # *must* match the extension id. - args += [ - "--appid", - app_id, - ] - } - - args += [ - "--app_name", - app_name, - ] - args += [ - "--app_description", - app_description, - ] - args += [ "--app_capabilities" ] + app_capabilities - args += [ - "--service_environment", - ar_service_environment, - ] - args += [ - "--manifest_key", - manifest_key, - ] - args += [ - "--app_client_id", - app_client_id, - ] } } diff --git a/remoting/webapp/crd/js/desktop_remoting.js b/remoting/webapp/crd/js/desktop_remoting.js index 113bd57..13e6b44 100644 --- a/remoting/webapp/crd/js/desktop_remoting.js +++ b/remoting/webapp/crd/js/desktop_remoting.js @@ -48,6 +48,15 @@ remoting.DesktopRemoting.prototype.getConnectionMode = function() { }; /** + * @return {string} Application Id. + * @override {remoting.ApplicationInterface} + */ +remoting.DesktopRemoting.prototype.getApplicationId = function() { + // Application IDs are not used in desktop remoting. + return ''; +}; + +/** * @return {string} Application product name to be used in UI. * @override {remoting.ApplicationInterface} */ diff --git a/remoting/webapp/crd/js/desktop_remoting_activity.js b/remoting/webapp/crd/js/desktop_remoting_activity.js index 2922ea3..6cc74fa 100644 --- a/remoting/webapp/crd/js/desktop_remoting_activity.js +++ b/remoting/webapp/crd/js/desktop_remoting_activity.js @@ -28,7 +28,7 @@ remoting.DesktopRemotingActivity = function(parentActivity) { /** @private */ this.sessionFactory_ = new remoting.ClientSessionFactory( document.querySelector('#client-container .client-plugin-container'), - remoting.app_capabilities()); + [/* No special capabilities required. */]); /** @private {remoting.ClientSession} */ this.session_ = null; diff --git a/remoting/webapp/files.gni b/remoting/webapp/files.gni index f10cd26..e096d18 100644 --- a/remoting/webapp/files.gni +++ b/remoting/webapp/files.gni @@ -171,7 +171,6 @@ remoting_webapp_shared_js_client_files = [ # Remoting core JavaScript files. remoting_webapp_shared_js_core_files = [ - "base/js/app_capabilities.js", "base/js/application.js", "base/js/base.js", "base/js/ipc.js", @@ -561,7 +560,6 @@ ar_main_js_files = [ "app_remoting/js/app_remoting.js", "app_remoting/js/app_remoting_activity.js", "app_remoting/js/ar_auth_dialog.js", - "app_remoting/js/ar_main.js", "app_remoting/js/context_menu_adapter.js", "app_remoting/js/context_menu_chrome.js", "app_remoting/js/context_menu_dom.js", @@ -573,8 +571,6 @@ ar_main_js_files = [ "app_remoting/js/loading_window.js", "app_remoting/js/submenu_manager.js", "app_remoting/js/window_activation_menu.js", - "base/js/application.js", - "base/js/base.js", "base/js/message_window_helper.js", "base/js/message_window_manager.js", ] + remoting_webapp_shared_js_auth_google_files + @@ -618,19 +614,33 @@ ar_feedback_consent_html_all_js_files = [ ar_loading_window_template = "app_remoting/html/template_loading_window.html" # -# AppRemoting background JS files. -# These files are referenced from the manifest +# AppRemoting ar_background.html generation files. # -ar_background_js_files = [ +ar_background_template = "app_remoting/html/template_background.html" +ar_background_html_js_files = [ "app_remoting/js/ar_background.js", "base/js/platform.js", ] +# +# Vendor supplied files. +# These need a full path specification because they are referenced from the +# webapp directory (ar_sample_app) and from the internal app directory. +# + +ar_vendor_js_files = [ "//remoting/webapp/app_remoting/vendor/arv_main.js" ] + +ar_vendor_html_files = [ + "//remoting/webapp/app_remoting/vendor/arv_background.html", + "//remoting/webapp/app_remoting/vendor/arv_main.html", + "//remoting/webapp/app_remoting/vendor/arv_wcs_sandbox.html", +] + ar_all_js_files = ar_main_js_files + ar_feedback_consent_html_js_files + remoting_webapp_message_window_html_js_files + - remoting_webapp_wcs_sandbox_html_js_files + ar_background_js_files + + remoting_webapp_wcs_sandbox_html_js_files + ar_background_html_js_files + remoting_webapp_credits_html_all_js_files # Files that contain localizable strings. |