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
3// found in the LICENSE file.
4
5#ifndef NET_HTTP_HTTP_REQUEST_INFO_H__
6#define NET_HTTP_HTTP_REQUEST_INFO_H__
7#pragma once
8
9#include <string>
10#include "base/memory/ref_counted.h"
11#include "googleurl/src/gurl.h"
12#include "net/base/request_priority.h"
13#include "net/base/upload_data.h"
14#include "net/http/http_request_headers.h"
15
16namespace net {
17
18struct HttpRequestInfo {
19  enum RequestMotivation{
20    // TODO(mbelshe): move these into Client Socket.
21    PRECONNECT_MOTIVATED,  // Request was motivated by a prefetch.
22    OMNIBOX_MOTIVATED,     // Request was motivated by the omnibox.
23    NORMAL_MOTIVATION,     // No special motivation associated with the request.
24    EARLY_LOAD_MOTIVATED,  // When browser asks a tab to open an URL, this short
25                           // circuits that path (of waiting for the renderer to
26                           // do the URL request), and starts loading ASAP.
27  };
28
29  HttpRequestInfo();
30  ~HttpRequestInfo();
31
32  // The requested URL.
33  GURL url;
34
35  // The referring URL (if any).
36  GURL referrer;
37
38  // The method to use (GET, POST, etc.).
39  std::string method;
40
41  // Any extra request headers (including User-Agent).
42  HttpRequestHeaders extra_headers;
43
44  // Any upload data.
45  scoped_refptr<UploadData> upload_data;
46
47  // Any load flags (see load_flags.h).
48  int load_flags;
49
50  // The priority level for this request.
51  RequestPriority priority;
52
53  // The motivation behind this request.
54  RequestMotivation motivation;
55
56  // An optional globally unique identifier for this request for use by the
57  // consumer. 0 is invalid.
58  uint64 request_id;
59
60#ifdef ANDROID
61  bool valid_uid;
62  uid_t calling_uid;
63#endif
64
65};
66
67}  // namespace net
68
69#endif  // NET_HTTP_HTTP_REQUEST_INFO_H__
70