summaryrefslogtreecommitdiffstats
path: root/mojo/services/network/url_loader_factory_impl.cc
blob: 2e19d5be6a5b858e0f9c0977b39749f08473a858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "mojo/services/network/url_loader_factory_impl.h"

#include <utility>

#include "mojo/services/network/url_loader_impl.h"

namespace mojo {

URLLoaderFactoryImpl::URLLoaderFactoryImpl(
    NetworkContext* context,
    scoped_ptr<mojo::MessageLoopRef> app_refcount,
    InterfaceRequest<URLLoaderFactory> request)
    : context_(context),
      app_refcount_(std::move(app_refcount)),
      binding_(this, std::move(request)) {}

URLLoaderFactoryImpl::~URLLoaderFactoryImpl() {
}

void URLLoaderFactoryImpl::CreateURLLoader(InterfaceRequest<URLLoader> loader) {
  // TODO(darin): Plumb origin. Use for CORS.
  // TODO(beng): Figure out how to get origin through to here.
  // The loader will delete itself when the pipe is closed, unless a request is
  // in progress. In which case, the loader will delete itself when the request
  // is finished.
  new URLLoaderImpl(context_, std::move(loader), app_refcount_->Clone());
}

}  // namespace mojo