OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @param {HTMLElement} parentNode Node to be parent for this dialog. | 8 * @param {HTMLElement} parentNode Node to be parent for this dialog. |
9 * @constructor | 9 * @constructor |
10 * @extends {cr.ui.dialogs.BaseDialog} | 10 * @extends {cr.ui.dialogs.BaseDialog} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 * @param {function()} callback Completion callback. | 49 * @param {function()} callback Completion callback. |
50 */ | 50 */ |
51 ShareDialog.WebViewAuthorizer.prototype.initialize = function(callback) { | 51 ShareDialog.WebViewAuthorizer.prototype.initialize = function(callback) { |
52 if (this.initialized_) { | 52 if (this.initialized_) { |
53 callback(); | 53 callback(); |
54 return; | 54 return; |
55 } | 55 } |
56 | 56 |
57 var registerInjectionHooks = function() { | 57 var registerInjectionHooks = function() { |
58 this.webView_.removeEventListener('loadstop', registerInjectionHooks); | 58 this.webView_.removeEventListener('loadstop', registerInjectionHooks); |
59 this.webView_.onBeforeSendHeaders.addListener( | 59 this.webView_.request.onBeforeSendHeaders.addListener( |
60 this.authorizeRequest_.bind(this), | 60 this.authorizeRequest_.bind(this), |
61 {urls: [this.urlPattern_]}, | 61 {urls: [this.urlPattern_]}, |
62 ['blocking', 'requestHeaders']); | 62 ['blocking', 'requestHeaders']); |
63 this.initialized_ = true; | 63 this.initialized_ = true; |
64 callback(); | 64 callback(); |
65 }.bind(this); | 65 }.bind(this); |
66 | 66 |
67 this.webView_.addEventListener('loadstop', registerInjectionHooks); | 67 this.webView_.addEventListener('loadstop', registerInjectionHooks); |
68 this.webView_.setAttribute('src', 'data:text/html,'); | 68 this.webView_.setAttribute('src', 'data:text/html,'); |
69 }; | 69 }; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 }.bind(this)); | 264 }.bind(this)); |
265 }; | 265 }; |
266 | 266 |
267 /** | 267 /** |
268 * Tells whether the share dialog is being shown or not. | 268 * Tells whether the share dialog is being shown or not. |
269 * @return {boolean} True if shown, false otherwise. | 269 * @return {boolean} True if shown, false otherwise. |
270 */ | 270 */ |
271 ShareDialog.prototype.isShowing = function() { | 271 ShareDialog.prototype.isShowing = function() { |
272 return this.container_.classList.contains('shown'); | 272 return this.container_.classList.contains('shown'); |
273 }; | 273 }; |
OLD | NEW |