OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * @fileoverview This file implements the ProxyFormController class, which | 6 * @fileoverview This file implements the ProxyFormController class, which |
7 * wraps a form element with logic that enables implementation of proxy | 7 * wraps a form element with logic that enables implementation of proxy |
8 * settings. | 8 * settings. |
9 * | 9 * |
10 * @author mkwst@google.com (Mike West) | 10 * @author mkwst@google.com (Mike West) |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 chrome.extension.sendRequest({type: 'clearError'}); | 517 chrome.extension.sendRequest({type: 'clearError'}); |
518 }, | 518 }, |
519 | 519 |
520 /** | 520 /** |
521 * Called in response to setting a regular window's proxy settings: checks | 521 * Called in response to setting a regular window's proxy settings: checks |
522 * for `lastError`, and then sets incognito settings (if they exist). | 522 * for `lastError`, and then sets incognito settings (if they exist). |
523 * | 523 * |
524 * @private | 524 * @private |
525 */ | 525 */ |
526 callbackForRegularSettings_: function() { | 526 callbackForRegularSettings_: function() { |
527 if (chrome.extension.lastError) { | 527 if (chrome.runtime.lastError) { |
528 this.generateAlert_(chrome.i18n.getMessage('errorSettingRegularProxy')); | 528 this.generateAlert_(chrome.i18n.getMessage('errorSettingRegularProxy')); |
529 return; | 529 return; |
530 } | 530 } |
531 if (this.config_.incognito) { | 531 if (this.config_.incognito) { |
532 chrome.proxy.settings.set( | 532 chrome.proxy.settings.set( |
533 {value: this.config_.incognito, scope: 'incognito_persistent'}, | 533 {value: this.config_.incognito, scope: 'incognito_persistent'}, |
534 this.callbackForIncognitoSettings_.bind(this)); | 534 this.callbackForIncognitoSettings_.bind(this)); |
535 } else { | 535 } else { |
536 ProxyFormController.setPersistedSettings(this.config_); | 536 ProxyFormController.setPersistedSettings(this.config_); |
537 this.generateAlert_(chrome.i18n.getMessage('successfullySetProxy')); | 537 this.generateAlert_(chrome.i18n.getMessage('successfullySetProxy')); |
538 } | 538 } |
539 }, | 539 }, |
540 | 540 |
541 /** | 541 /** |
542 * Called in response to setting an incognito window's proxy settings: checks | 542 * Called in response to setting an incognito window's proxy settings: checks |
543 * for `lastError` and sets a success message. | 543 * for `lastError` and sets a success message. |
544 * | 544 * |
545 * @private | 545 * @private |
546 */ | 546 */ |
547 callbackForIncognitoSettings_: function() { | 547 callbackForIncognitoSettings_: function() { |
548 if (chrome.extension.lastError) { | 548 if (chrome.runtime.lastError) { |
549 this.generateAlert_(chrome.i18n.getMessage('errorSettingIncognitoProxy')); | 549 this.generateAlert_(chrome.i18n.getMessage('errorSettingIncognitoProxy')); |
550 return; | 550 return; |
551 } | 551 } |
552 ProxyFormController.setPersistedSettings(this.config_); | 552 ProxyFormController.setPersistedSettings(this.config_); |
553 this.generateAlert_( | 553 this.generateAlert_( |
554 chrome.i18n.getMessage('successfullySetProxy')); | 554 chrome.i18n.getMessage('successfullySetProxy')); |
555 }, | 555 }, |
556 | 556 |
557 /** | 557 /** |
558 * Generates an alert overlay inside the proxy's popup, then closes the popup | 558 * Generates an alert overlay inside the proxy's popup, then closes the popup |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 console.error(error); | 784 console.error(error); |
785 // TODO(mkwst): Do something more interesting | 785 // TODO(mkwst): Do something more interesting |
786 this.generateAlert_( | 786 this.generateAlert_( |
787 chrome.i18n.getMessage( | 787 chrome.i18n.getMessage( |
788 error.details ? 'errorProxyDetailedError' : 'errorProxyError', | 788 error.details ? 'errorProxyDetailedError' : 'errorProxyError', |
789 [error.error, error.details]), | 789 [error.error, error.details]), |
790 false); | 790 false); |
791 } | 791 } |
792 } | 792 } |
793 }; | 793 }; |
OLD | NEW |