summaryrefslogtreecommitdiffstats
path: root/ios/web/navigation/web_load_params.h
blob: 427cb2fedc4cea9acd3ce56aa89afd8cd96455f2 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2013 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.

#ifndef IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_
#define IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_

#import <Foundation/Foundation.h>

#import "base/mac/scoped_nsobject.h"
#include "ios/web/public/referrer.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"

namespace web {

// Parameters for URL loading. Most parameters are optional, and can be left at
// the default values set by the constructor.
// TODO(crbug.com/597990): Move this into NavigationManager to parallel
// NavigationController's LoadURLParams (which this is modeled after).
struct WebLoadParams {
 public:
  // The URL to load. Must be set.
  GURL url;

  // The referrer for the load. May be empty.
  Referrer referrer;

  // The transition type for the load. Defaults to PAGE_TRANSITION_LINK.
  ui::PageTransition transition_type;

  // True for renderer-initiated navigations. This is
  // important for tracking whether to display pending URLs.
  bool is_renderer_initiated;

  // Any extra HTTP headers to add to the load.
  base::scoped_nsobject<NSDictionary> extra_headers;

  // Any post data to send with the load. When setting this, you should
  // generally set a Content-Type header as well.
  base::scoped_nsobject<NSData> post_data;

  // Create a new WebLoadParams with the given URL and defaults for all other
  // parameters.
  explicit WebLoadParams(const GURL& url);
  ~WebLoadParams();

  // Allow copying WebLoadParams.
  WebLoadParams(const WebLoadParams& other);
  WebLoadParams& operator=(const WebLoadParams& other);
};

}  // namespace web

#endif  // IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_