| 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_PUBLIC_NAVIGATION_MANAGER_H_ | 5 #ifndef IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ |
| 6 #define IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ | 6 #define IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #import "base/mac/scoped_nsobject.h" |
| 10 #include "ios/web/public/browser_url_rewriter.h" | 11 #include "ios/web/public/browser_url_rewriter.h" |
| 12 #include "ios/web/public/referrer.h" |
| 13 #include "ui/base/page_transition_types.h" |
| 14 |
| 15 @class NSDictionary; |
| 16 @class NSData; |
| 11 | 17 |
| 12 namespace web { | 18 namespace web { |
| 13 | 19 |
| 14 class BrowserState; | 20 class BrowserState; |
| 15 class NavigationItem; | 21 class NavigationItem; |
| 16 class WebState; | 22 class WebState; |
| 17 | 23 |
| 18 // A NavigationManager maintains the back-forward list for a WebState and | 24 // A NavigationManager maintains the back-forward list for a WebState and |
| 19 // manages all navigation within that list. | 25 // manages all navigation within that list. |
| 20 // | 26 // |
| 21 // Each NavigationManager belongs to one WebState; each WebState has | 27 // Each NavigationManager belongs to one WebState; each WebState has |
| 22 // exactly one NavigationManager. | 28 // exactly one NavigationManager. |
| 23 class NavigationManager { | 29 class NavigationManager { |
| 24 public: | 30 public: |
| 31 // Parameters for URL loading. Most parameters are optional, and can be left |
| 32 // at the default values set by the constructor. |
| 33 struct WebLoadParams { |
| 34 public: |
| 35 // The URL to load. Must be set. |
| 36 GURL url; |
| 37 |
| 38 // The referrer for the load. May be empty. |
| 39 Referrer referrer; |
| 40 |
| 41 // The transition type for the load. Defaults to PAGE_TRANSITION_LINK. |
| 42 ui::PageTransition transition_type; |
| 43 |
| 44 // True for renderer-initiated navigations. This is |
| 45 // important for tracking whether to display pending URLs. |
| 46 bool is_renderer_initiated; |
| 47 |
| 48 // Any extra HTTP headers to add to the load. |
| 49 base::scoped_nsobject<NSDictionary> extra_headers; |
| 50 |
| 51 // Any post data to send with the load. When setting this, you should |
| 52 // generally set a Content-Type header as well. |
| 53 base::scoped_nsobject<NSData> post_data; |
| 54 |
| 55 // Create a new WebLoadParams with the given URL and defaults for all other |
| 56 // parameters. |
| 57 explicit WebLoadParams(const GURL& url); |
| 58 ~WebLoadParams(); |
| 59 |
| 60 // Allow copying WebLoadParams. |
| 61 WebLoadParams(const WebLoadParams& other); |
| 62 WebLoadParams& operator=(const WebLoadParams& other); |
| 63 }; |
| 64 |
| 25 virtual ~NavigationManager() {} | 65 virtual ~NavigationManager() {} |
| 26 | 66 |
| 27 // Gets the BrowserState associated with this NavigationManager. Can never | 67 // Gets the BrowserState associated with this NavigationManager. Can never |
| 28 // return null. | 68 // return null. |
| 29 virtual BrowserState* GetBrowserState() const = 0; | 69 virtual BrowserState* GetBrowserState() const = 0; |
| 30 | 70 |
| 31 // Gets the WebState associated with this NavigationManager. | 71 // Gets the WebState associated with this NavigationManager. |
| 32 virtual WebState* GetWebState() const = 0; | 72 virtual WebState* GetWebState() const = 0; |
| 33 | 73 |
| 34 // Returns the NavigationItem that should be used when displaying info about | 74 // Returns the NavigationItem that should be used when displaying info about |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Reloads the current entry. If |check_for_repost| is true and the current | 138 // Reloads the current entry. If |check_for_repost| is true and the current |
| 99 // entry has POST data the user is prompted to see if they really want to | 139 // entry has POST data the user is prompted to see if they really want to |
| 100 // reload the page. In nearly all cases pass in true. If a transient entry | 140 // reload the page. In nearly all cases pass in true. If a transient entry |
| 101 // is showing, initiates a new navigation to its URL. | 141 // is showing, initiates a new navigation to its URL. |
| 102 virtual void Reload(bool check_for_repost) = 0; | 142 virtual void Reload(bool check_for_repost) = 0; |
| 103 }; | 143 }; |
| 104 | 144 |
| 105 } // namespace web | 145 } // namespace web |
| 106 | 146 |
| 107 #endif // IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ | 147 #endif // IOS_WEB_PUBLIC_NAVIGATION_MANAGER_H_ |
| OLD | NEW |