OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Authenticator class wraps the communications between Gaia and its host. | 6 * Authenticator class wraps the communications between Gaia and its host. |
7 */ | 7 */ |
8 function Authenticator() { | 8 function Authenticator() { |
9 } | 9 } |
10 | 10 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 var gaiaFrame = $('gaia-frame'); | 161 var gaiaFrame = $('gaia-frame'); |
162 gaiaFrame.partition = this.partitionId_; | 162 gaiaFrame.partition = this.partitionId_; |
163 gaiaFrame.src = this.initialFrameUrl_; | 163 gaiaFrame.src = this.initialFrameUrl_; |
164 if (this.inlineMode_) { | 164 if (this.inlineMode_) { |
165 gaiaFrame.addEventListener( | 165 gaiaFrame.addEventListener( |
166 'loadstop', this.onWebviewLoadstop_.bind(this, gaiaFrame)); | 166 'loadstop', this.onWebviewLoadstop_.bind(this, gaiaFrame)); |
167 gaiaFrame.addEventListener( | 167 gaiaFrame.addEventListener( |
168 'newwindow', this.onWebviewNewWindow_.bind(this, gaiaFrame)); | 168 'newwindow', this.onWebviewNewWindow_.bind(this, gaiaFrame)); |
169 } | 169 } |
170 if (this.constrained_) { | 170 if (this.constrained_) { |
| 171 var preventContextMenu = 'document.addEventListener("contextmenu", ' + |
| 172 'function(e) {e.preventDefault();})'; |
| 173 gaiaFrame.executeScript({code: preventContextMenu}); |
171 gaiaFrame.request.onCompleted.addListener( | 174 gaiaFrame.request.onCompleted.addListener( |
172 this.onWebviewRequestCompleted_.bind(this), | 175 this.onWebviewRequestCompleted_.bind(this), |
173 {urls: ['<all_urls>'], types: ['main_frame']}, | 176 {urls: ['<all_urls>'], types: ['main_frame']}, |
174 ['responseHeaders']); | 177 ['responseHeaders']); |
175 } | 178 } |
176 }, | 179 }, |
177 | 180 |
178 completeLogin: function(username, password) { | 181 completeLogin: function(username, password) { |
179 var msg = { | 182 var msg = { |
180 'method': 'completeLogin', | 183 'method': 'completeLogin', |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } else if (msg.method == 'redirectToSignin' && | 337 } else if (msg.method == 'redirectToSignin' && |
335 this.isParentMessage_(e)) { | 338 this.isParentMessage_(e)) { |
336 $('gaia-frame').src = this.constructInitialFrameUrl_(); | 339 $('gaia-frame').src = this.constructInitialFrameUrl_(); |
337 } else { | 340 } else { |
338 console.error('Authenticator.onMessage: unknown message + origin!?'); | 341 console.error('Authenticator.onMessage: unknown message + origin!?'); |
339 } | 342 } |
340 } | 343 } |
341 }; | 344 }; |
342 | 345 |
343 Authenticator.getInstance().initialize(); | 346 Authenticator.getInstance().initialize(); |
OLD | NEW |