 -      "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",
+-  "content_security_policy": "default-src 'self'; script-src 'self' TALK_GADGET_HOST; style-src 'self' https://fonts.googleapis.com; img-src 'self' TALK_GADGET_HOST; font-src *; connect-src 'self' OAUTH2_ACCOUNTS_HOST GOOGLE_API_HOSTS TALK_GADGET_HOST https://relay.google.com",
    "permissions": [
-+    "experimental",
-+    "storage",
-     "https://accounts.google.com/*",
-     "https://www.googleapis.com/chromoting/*",
-     "https://*.talkgadget.google.com/talkgadget/*",
-@@ -31,14 +25,17 @@
+     "OAUTH2_ACCOUNTS_HOST/*",
+     "OAUTH2_API_BASE_URL/*",
+@@ -30,17 +22,22 @@
+     "TALK_GADGET_HOST/talkgadget/*",
+     "https://relay.google.com/*",
      "clipboardRead",
-     "clipboardWrite"
-   ],
+-    "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 }
--  ],
++    "clipboardWrite",
++    "experimental",
++    "storage"
+   ],
 +  "oauth2": {
 +    "client_id": "45833509441.apps.googleusercontent.com",
 +    "scopes": [

 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.tableRow.addEventListener('click', this.onConnectReference_, false);
     }
diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html
index 061caeb..f61e532 100644
--- a/main.html
+++ b/main.html
@@ -33,6 +33,7 @@ found in the LICENSE file.
     <script src="host_settings.js"></script>
     <script src="host_setup_dialog.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 5be9243..39052b9 100644
--- a/manifest.json
+++ b/manifest.json
@@ -5,24 +5,16 @@
   "manifest_version": 2,
   "default_locale": "en",
   "app": {
-    "launch": {
-      "local_path": "main.html"
+    "background": {
+      "scripts": ["background.js"]
     }
   },
+  "key": "chromotingappsv2",
   "icons": {
     "128": "chromoting128.webp",
     "48": "chromoting48.webp",
     "16": "chromoting16.webp"
   },
-  "content_scripts": [
-    {
