| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_ | 5 #ifndef IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_ |
| 6 #define IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_ | 6 #define IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| 11 #include "ios/net/request_tracker.h" | |
| 12 #include "ios/web/public/referrer.h" | 11 #include "ios/web/public/referrer.h" |
| 13 #include "ui/base/page_transition_types.h" | 12 #include "ui/base/page_transition_types.h" |
| 14 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 15 | 14 |
| 16 namespace web { | 15 namespace web { |
| 17 | 16 |
| 18 // Parameters for creating a tab. Most paramaters are optional, and | 17 // Parameters for URL loading. Most parameters are optional, and can be left at |
| 19 // can be left at the default values set by the constructor. | 18 // the default values set by the constructor. |
| 20 // TODO(stuartmorgan): Remove the dependency on RequestTracker, then move | 19 // TODO(crbug.com/597990): Move this into NavigationManager to parallel |
| 21 // this into NavigationManager to parallel NavigationController's | 20 // NavigationController's LoadURLParams (which this is modeled after). |
| 22 // LoadURLParams (which this is modeled after). | |
| 23 struct WebLoadParams { | 21 struct WebLoadParams { |
| 24 public: | 22 public: |
| 25 // The URL to load. Must be set. | 23 // The URL to load. Must be set. |
| 26 GURL url; | 24 GURL url; |
| 27 | 25 |
| 28 // The referrer for the load. May be empty. | 26 // The referrer for the load. May be empty. |
| 29 Referrer referrer; | 27 Referrer referrer; |
| 30 | 28 |
| 31 // The transition type for the load. Defaults to PAGE_TRANSITION_LINK. | 29 // The transition type for the load. Defaults to PAGE_TRANSITION_LINK. |
| 32 ui::PageTransition transition_type; | 30 ui::PageTransition transition_type; |
| 33 | 31 |
| 34 // True for renderer-initiated navigations. This is | 32 // True for renderer-initiated navigations. This is |
| 35 // important for tracking whether to display pending URLs. | 33 // important for tracking whether to display pending URLs. |
| 36 bool is_renderer_initiated; | 34 bool is_renderer_initiated; |
| 37 | 35 |
| 38 // The cache mode to load with. Defaults to CACHE_NORMAL. | |
| 39 net::RequestTracker::CacheMode cache_mode; | |
| 40 | |
| 41 // Any extra HTTP headers to add to the load. | 36 // Any extra HTTP headers to add to the load. |
| 42 base::scoped_nsobject<NSDictionary> extra_headers; | 37 base::scoped_nsobject<NSDictionary> extra_headers; |
| 43 | 38 |
| 44 // Any post data to send with the load. When setting this, you should | 39 // Any post data to send with the load. When setting this, you should |
| 45 // generally set a Content-Type header as well. | 40 // generally set a Content-Type header as well. |
| 46 base::scoped_nsobject<NSData> post_data; | 41 base::scoped_nsobject<NSData> post_data; |
| 47 | 42 |
| 48 // Create a new WebLoadParams with the given URL and defaults for all other | 43 // Create a new WebLoadParams with the given URL and defaults for all other |
| 49 // parameters. | 44 // parameters. |
| 50 explicit WebLoadParams(const GURL& url); | 45 explicit WebLoadParams(const GURL& url); |
| 51 ~WebLoadParams(); | 46 ~WebLoadParams(); |
| 52 | 47 |
| 53 // Allow copying WebLoadParams. | 48 // Allow copying WebLoadParams. |
| 54 WebLoadParams(const WebLoadParams& other); | 49 WebLoadParams(const WebLoadParams& other); |
| 55 WebLoadParams& operator=(const WebLoadParams& other); | 50 WebLoadParams& operator=(const WebLoadParams& other); |
| 56 }; | 51 }; |
| 57 | 52 |
| 58 } // namespace web | 53 } // namespace web |
| 59 | 54 |
| 60 #endif // IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_ | 55 #endif // IOS_WEB_NAVIGATION_WEB_LOAD_PARAMS_H_ |
| OLD | NEW |