diff options
author | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 21:11:33 +0000 |
---|---|---|
committer | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 21:11:33 +0000 |
commit | 2f64f3557446132f80eae5046c57e53eedce1396 (patch) | |
tree | 82cfbb988556f7345f81898897c57fdf0ebe4e71 /remoting | |
parent | 6a3dd6c1f0ed7bed4fd90b90573ef27b02657b88 (diff) | |
download | chromium_src-2f64f3557446132f80eae5046c57e53eedce1396.zip chromium_src-2f64f3557446132f80eae5046c57e53eedce1396.tar.gz chromium_src-2f64f3557446132f80eae5046c57e53eedce1396.tar.bz2 |
Allow an AppsV2 build to be configured using GYP.
BUG=134213
TEST=Use GYP_DEFINES="remoting_use_apps_v2=1"
Review URL: https://codereview.chromium.org/11875021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/remoting.gyp | 24 | ||||
-rw-r--r-- | remoting/webapp/appsv2.patch | 140 | ||||
-rwxr-xr-x | remoting/webapp/build-webapp.py | 37 |
3 files changed, 192 insertions, 9 deletions
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index abd4d0ce8..902fb72 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -20,6 +20,7 @@ }, 'remoting_multi_process%': '<(remoting_multi_process)', + 'remoting_use_apps_v2%': 0, # The |major|, |build| and |patch| versions are inherited from Chrome. # Since Chrome's |minor| version is always '0', we replace it with a @@ -1696,8 +1697,10 @@ 'webapp/build-webapp.py', '<(remoting_version_path)', '<(chrome_version_path)', + '<@(remoting_webapp_patch_files)', '<@(remoting_webapp_files)', '<@(remoting_webapp_js_files)', + '<@(remoting_webapp_apps_v2_js_files)', '<@(remoting_webapp_locale_files)', ], @@ -1714,6 +1717,22 @@ 'remoting_host_plugin', ], }], + ['remoting_use_apps_v2==1', { + 'variables': { + 'remoting_webapp_patch_files': [ + 'webapp/appsv2.patch', + ], + 'remoting_webapp_apps_v2_js_files': [ + 'webapp/background.js', + 'webapp/identity.js', + ], + }, + }, { + 'variables': { + 'remoting_webapp_patch_files': [], + 'remoting_webapp_apps_v2_js_files': [], + }, + }], ], # Can't use a 'copies' because we need to manipulate @@ -1731,8 +1750,10 @@ 'webapp/build-webapp.py', '<(remoting_version_path)', '<(chrome_version_path)', + '<@(remoting_webapp_patch_files)', '<@(remoting_webapp_files)', '<@(remoting_webapp_js_files)', + '<@(remoting_webapp_apps_v2_js_files)', '<@(remoting_webapp_locale_files)', ], 'conditions': [ @@ -1756,8 +1777,11 @@ '<(plugin_path)', '<@(remoting_webapp_files)', '<@(remoting_webapp_js_files)', + '<@(remoting_webapp_apps_v2_js_files)', '--locales', '<@(remoting_webapp_locale_files)', + '--patches', + '<@(remoting_webapp_patch_files)', ], 'msvs_cygwin_shell': 1, }, diff --git a/remoting/webapp/appsv2.patch b/remoting/webapp/appsv2.patch new file mode 100644 index 0000000..24747c0 --- /dev/null +++ b/remoting/webapp/appsv2.patch @@ -0,0 +1,140 @@ +diff --git a/remoting/webapp/event_handlers.js b/remoting/webapp/event_handlers.js +index 5659a77..fd727d1 100644 +--- a/event_handlers.js ++++ b/event_handlers.js +@@ -62,7 +62,6 @@ function onLoad() { + fn: remoting.sendCtrlAltDel }, + { event: 'click', id: 'send-print-screen', + fn: remoting.sendPrintScreen }, +- { event: 'click', id: 'auth-button', fn: doAuthRedirect }, + { event: 'click', id: 'share-button', fn: remoting.tryShare }, + { event: 'click', id: 'access-mode-button', fn: goEnterAccessCode }, + { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, +@@ -124,6 +123,4 @@ function onBeforeUnload() { + } + + window.addEventListener('load', onLoad, false); +-window.addEventListener('beforeunload', onBeforeUnload, false); + window.addEventListener('resize', remoting.onResize, false); +-window.addEventListener('unload', remoting.disconnect, false); +diff --git a/remoting/webapp/host_controller.js b/remoting/webapp/host_controller.js +index 5f04bce..517696d 100644 +--- a/host_controller.js ++++ b/host_controller.js +@@ -310,7 +310,7 @@ remoting.HostController.prototype.getLocalHostStateAndId = function(onDone) { + onDone(state, that.localHostId_); + }; + try { +- this.plugin_.getDaemonConfig(onConfig); ++ onConfig('{}'); + } catch (err) { + onDone(remoting.HostController.State.NOT_IMPLEMENTED, null); + } +diff --git a/remoting/webapp/host_table_entry.js b/remoting/webapp/host_table_entry.js +index 7c7fb11..4255d88 100644 +--- a/host_table_entry.js ++++ b/host_table_entry.js +@@ -191,9 +191,7 @@ remoting.HostTableEntry.prototype.updateStatus = function(opt_forEdit) { + /** @type {string} */ + var encodedHostId = encodeURIComponent(this.host.hostId) + this.onConnectReference_ = function() { +- var hostUrl = chrome.extension.getURL('main.html') + +- '?mode=me2me&hostId=' + encodedHostId; +- window.location.assign(hostUrl); ++ remoting.connectMe2Me(encodedHostId, true); + }; + this.tableRow.addEventListener('click', this.onConnectReference_, false); + } +diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html +index 26fa487..d69f54e 100644 +--- a/main.html ++++ b/main.html +@@ -31,6 +31,7 @@ found in the LICENSE file. + <script src="host_screen.js"></script> + <script src="host_session.js"></script> + <script src="host_table_entry.js"></script> ++ <script src="identity.js"></script> + <script src="l10n.js"></script> + <script src="log_to_server.js"></script> + <script src="menu_button.js"></script> +diff --git a/remoting/webapp/manifest.json b/remoting/webapp/manifest.json +index a52b1da..fdae490 100644 +--- a/manifest.json ++++ b/manifest.json +@@ -2,25 +2,19 @@ + "description": "__MSG_PRODUCT_DESCRIPTION__", + "default_locale": "en", +- "app": { +- "launch": { +- "local_path": "main.html" ++ "app" : { ++ "background": { ++ "scripts": ["background.js"] + } + }, ++ "key": "chromotingappsv2", + "icons": { + "128": "chromoting128.png", + "48": "chromoting48.png", + "16": "chromoting16.png" + }, +- "content_scripts": [ +- { +- "matches": [ +- "OAUTH2_REDIRECT_URL" +- ], +- "js": [ "cs_oauth2_trampoline.js" ] +- } +- ], +- "content_security_policy": "default-src 'self'; script-src 'self' https://*.talkgadget.google.com; style-src 'self' https://fonts.googleapis.com; img-src 'self' https://*.talkgadget.google.com; font-src *; connect-src 'self' https://accounts.google.com https://www.googleapis.com https://*.talkgadget.google.com https://relay.google.com", + "permissions": [ ++ "experimental", ++ "storage", + "https://accounts.google.com/*", + "https://www.googleapis.com/chromoting/*", + "https://*.talkgadget.google.com/talkgadget/*", +@@ -31,12 +25,12 @@ + "clipboardRead", + "clipboardWrite" + ], +- "plugins": [ +- { "path": "remoting_host_plugin.dll", "public": false }, +- { "path": "libremoting_host_plugin.ia32.so", "public": false }, +- { "path": "libremoting_host_plugin.x64.so", "public": false }, +- { "path": "remoting_host_plugin.plugin", "public": false } +- ], ++ "oauth2": { ++ "client_id": "45833509441.apps.googleusercontent.com", ++ "scopes": [ ++ "https://www.googleapis.com/auth/chromoting https://www.googleapis.com/auth/googletalk https://www.googleapis.com/auth/userinfo#email" ++ ] ++ }, + "requirements": { + "plugins": { + "npapi": false +diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js +index a8ab35b..9c6df35 100644 +--- a/remoting.js ++++ b/remoting.js +@@ -39,10 +47,7 @@ remoting.init = function() { + l10n.localize(); + // Create global objects. + remoting.oauth2 = new remoting.OAuth2(); +- // TODO(jamiewalch): Reinstate this when we migrate to apps v2 +- // (http://crbug.com/ 134213). +- // remoting.identity = new remoting.Identity(consentRequired_); +- remoting.identity = remoting.oauth2; ++ remoting.identity = new remoting.Identity(consentRequired_); + remoting.stats = new remoting.ConnectionStats( + document.getElementById('statistics')); + remoting.formatIq = new remoting.FormatIq(); +@@ -119,9 +126,6 @@ remoting.initDaemonUi = function () { + document.getElementById('share-button').disabled = + !remoting.hostController.isPluginSupported(); + remoting.setMode(remoting.AppMode.HOME); +- if (!remoting.oauth2.isAuthenticated()) { +- document.getElementById('auth-dialog').hidden = false; +- } + remoting.hostSetupDialog = + new remoting.HostSetupDialog(remoting.hostController); + // Display the cached host list, then asynchronously update and re-display it. diff --git a/remoting/webapp/build-webapp.py b/remoting/webapp/build-webapp.py index e6f5ab2..966ddb5 100755 --- a/remoting/webapp/build-webapp.py +++ b/remoting/webapp/build-webapp.py @@ -56,7 +56,7 @@ def createZip(zip_path, directory): def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, - files, locales): + files, locales, patches): """Does the main work of building the webapp directory and zipfile. Args: @@ -71,6 +71,11 @@ def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, in this webapp. locales: An array of strings listing locales, which are copied, along with their directory structure from the _locales directory down. + patches: An array of strings listing patch files to be applied to the + webapp directory. Paths in the patch file should be relative to + the remoting/webapp directory, for example a/main.html. Since + 'git diff -p' works relative to the src/ directory, patches + obtained this way will need to be edited. """ # Ensure a fresh directory. try: @@ -159,6 +164,15 @@ def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, if ((platform.system() == 'Linux') and (buildtype == 'Official')): subprocess.call(["strip", newPluginPath]) + # Patch the files, if necessary. Do this before updating any placeholders + # in case any of the diff contexts refer to the placeholders. + for patch in patches: + patchfile = os.path.join(os.getcwd(), patch) + if subprocess.call(['patch', '-d', destination, '-i', patchfile, + '-p1']) != 0: + print 'Patch ' + patch + ' failed to apply.' + return 1 + # Set the version number in the manifest version. findAndReplace(os.path.join(destination, 'manifest.json'), 'FULL_APP_VERSION', @@ -202,28 +216,33 @@ def buildWebApp(buildtype, version, mimetype, destination, zip_path, plugin, # Make the zipfile. createZip(zip_path, destination) + return 0 + def main(): if len(sys.argv) < 7: print ('Usage: build-webapp.py ' '<build-type> <version> <mime-type> <dst> <zip-path> <plugin> ' - '<other files...> --locales <locales...>') + '<other files...> [--patches <patches...>] ' + '[--locales <locales...>]') return 1 - reading_locales = False + arg_type = '' files = [] locales = [] + patches = [] for arg in sys.argv[7:]: - if arg == "--locales": - reading_locales = True; - elif reading_locales: + if arg == '--locales' or arg == '--patches': + arg_type = arg + elif arg_type == '--locales': locales.append(arg) + elif arg_type == '--patches': + patches.append(arg) else: files.append(arg) - buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], - sys.argv[6], files, locales) - return 0 + return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], + sys.argv[5], sys.argv[6], files, locales, patches) if __name__ == '__main__': |