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
3// found in the LICENSE file.
4
5#ifndef CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_URL_REQUEST_CONTEXT_GETTER_H_
6#define CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_URL_REQUEST_CONTEXT_GETTER_H_
7
8#include "base/basictypes.h"
9#include "base/memory/scoped_ptr.h"
10#include "net/url_request/url_request_context_getter.h"
11
12// Used to return a dummy context, which lives on the message loop
13// given in the constructor.
14class CloudPrintURLRequestContextGetter : public net::URLRequestContextGetter {
15 public:
16  // |task_runner| must not be NULL.
17  explicit CloudPrintURLRequestContextGetter(
18      scoped_refptr<base::SingleThreadTaskRunner> task_runner);
19
20  // URLRequestContextGetter implementation.
21  virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
22
23  virtual scoped_refptr<base::SingleThreadTaskRunner>
24    GetNetworkTaskRunner() const OVERRIDE;
25
26 private:
27  virtual ~CloudPrintURLRequestContextGetter();
28
29  scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
30  scoped_ptr<net::URLRequestContext> context_;
31
32  DISALLOW_COPY_AND_ASSIGN(CloudPrintURLRequestContextGetter);
33};
34
35#endif  // CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_URL_REQUEST_CONTEXT_GETTER_H_
36
37