# 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');2223goog.require('goog.net.XmlHttpFactory');24252627/**28 * An xhr factory subclass which can be constructed using two factory methods.29 * This exists partly to allow the preservation of goog.net.XmlHttp.setFactory()30 * with an unchanged signature.31 * @param {function() : !(XMLHttpRequest|GearsHttpRequest)} xhrFactory A32 *     function which returns a new XHR object.33 * @param {function() : !Object} optionsFactory A function which returns the34 *     options associated with xhr objects from this factory.35 * @extends {goog.net.XmlHttpFactory}36 * @constructor37 */38goog.net.WrapperXmlHttpFactory = function(xhrFactory, optionsFactory) {39  goog.net.XmlHttpFactory.call(this);4041  /**42   * XHR factory method.43   * @type {function() : !(XMLHttpRequest|GearsHttpRequest)}44   * @private45   */46  this.xhrFactory_ = xhrFactory;4748  /**49   * Options factory method.50   * @type {function() : !Object}51   * @private52   */53  this.optionsFactory_ = optionsFactory;54};55goog.inherits(goog.net.WrapperXmlHttpFactory, goog.net.XmlHttpFactory);565758/** @override */59goog.net.WrapperXmlHttpFactory.prototype.createInstance = function() {60  return this.xhrFactory_();61};626364/** @override */65goog.net.WrapperXmlHttpFactory.prototype.getOptions = function() {66  return this.optionsFactory_();67};68