# lib/goog/net/wrapperxmlhttpfactory.js

    1// Copyright 2010 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7//      http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.1415/**16 * @fileoverview Implementation of XmlHttpFactory which allows construction from17 * simple factory methods.18 * @author dbk@google.com (David Barrett-Kahn)19 */2021goog.provide('goog.net.WrapperXmlHttpFactory');2223/** @suppress {extraRequire} Typedef. */24goog.require('goog.net.XhrLike');25goog.require('goog.net.XmlHttpFactory');26272829/**30 * An xhr factory subclass which can be constructed using two factory methods.31 * This exists partly to allow the preservation of goog.net.XmlHttp.setFactory()32 * with an unchanged signature.33 * @param {function():!goog.net.XhrLike.OrNative} xhrFactory34 *     A function which returns a new XHR object.35 * @param {function():!Object} optionsFactory A function which returns the36 *     options associated with xhr objects from this factory.37 * @extends {goog.net.XmlHttpFactory}38 * @constructor39 * @final40 */41goog.net.WrapperXmlHttpFactory = function(xhrFactory, optionsFactory) {42  goog.net.XmlHttpFactory.call(this);4344  /**45   * XHR factory method.46   * @type {function() : !goog.net.XhrLike.OrNative}47   * @private48   */49  this.xhrFactory_ = xhrFactory;5051  /**52   * Options factory method.53   * @type {function() : !Object}54   * @private55   */56  this.optionsFactory_ = optionsFactory;57};58goog.inherits(goog.net.WrapperXmlHttpFactory, goog.net.XmlHttpFactory);596061/** @override */62goog.net.WrapperXmlHttpFactory.prototype.createInstance = function() {63  return this.xhrFactory_();64};656667/** @override */68goog.net.WrapperXmlHttpFactory.prototype.getOptions = function() {69  return this.optionsFactory_();70};71