Chromium Code Reviews| Index: content/public/browser/navigation_controller.h |
| diff --git a/content/public/browser/navigation_controller.h b/content/public/browser/navigation_controller.h |
| index 4932ba0f0a155612446fe43ad9f53fcccf95a4bf..760522233585a522bbc63c79d1f36b20ca473c1a 100644 |
| --- a/content/public/browser/navigation_controller.h |
| +++ b/content/public/browser/navigation_controller.h |
| @@ -8,12 +8,13 @@ |
| #include <string> |
| #include <vector> |
| +#include "base/memory/ref_counted_memory.h" |
| #include "base/string16.h" |
| #include "content/common/content_export.h" |
| #include "content/public/browser/global_request_id.h" |
| #include "content/public/common/page_transition_types.h" |
| - |
| -class GURL; |
| +#include "content/public/common/referrer.h" |
| +#include "googleurl/src/gurl.h" |
| namespace content { |
| @@ -21,7 +22,6 @@ class BrowserContext; |
| class NavigationEntry; |
| class SessionStorageNamespace; |
| class WebContents; |
| -struct Referrer; |
| // A NavigationController maintains the back-forward list for a WebContents and |
| // manages all navigation within that list. |
| @@ -36,6 +36,35 @@ class NavigationController { |
| RELOAD_IGNORING_CACHE // Reload bypassing the cache, aka shift-reload. |
| }; |
| + // Load type used in LoadURLParams. |
| + enum LoadURLType { |
| + // For loads that do not fall into any types below. |
| + LOAD_TYPE_DEFAULT, |
| + |
| + // An http post load request initiated from browser side. |
| + // The post data is passed in |browser_initiated_post_data|. |
| + LOAD_TYPE_BROWSER_INITIATED_HTTP_POST, |
| + |
| + // Loads a 'data:' scheme URL with specified base URL and a history entry |
| + // URL. This is only safe to be used for browser-initiated data: URL |
| + // navigations, since it shows arbitrary content as if it comes from |
| + // |virtual_url_for_data_url|. |
| + LOAD_TYPE_DATA |
| + }; |
| + |
| + // User agent override type used in LoadURLParams. |
| + enum UserAgentOverrideOption { |
| + // Use the override value from the previous NavigationEntry in the |
| + // NavigationController. |
| + UA_OVERRIDE_INHERIT, |
| + |
| + // Use the default user agent. |
| + UA_OVERRIDE_FALSE, |
| + |
| + // Use the user agent override, if it's available. |
| + UA_OVERRIDE_TRUE |
| + }; |
| + |
| // Creates a navigation entry and translates the virtual url to a real one. |
| // This is a general call; prefer LoadURL[FromRenderer]/TransferURL below. |
| // Extra headers are separated by \n. |
| @@ -47,6 +76,59 @@ class NavigationController { |
| const std::string& extra_headers, |
| BrowserContext* browser_context); |
| + // Extra optional parameters for LoadURLWithParams. |
| + CONTENT_EXPORT struct LoadURLParams { |
| + // The url to load. This field is required. |
| + const GURL url; |
| + |
| + // See LoadURLType comments above. |
| + LoadURLType load_type; |
| + |
| + // PageTransition for this load. See PageTransition for details. |
| + // Note the default value in constructor below. |
| + PageTransition transition_type; |
| + |
| + // Referrer for this load. Empty if none. |
| + Referrer referrer; |
| + |
| + // Extra headers for this load, separated by \n. |
| + std::string extra_headers; |
| + |
| + // True for renderer-initiated navigations. This is |
| + // important for tracking whether to display pending URLs. |
| + bool is_renderer_initiated; |
| + |
| + // User agent override for this load. See comments in |
| + // UserAgentOverrideOption definition. |
| + UserAgentOverrideOption override_user_agent; |
| + |
| + // Marks the new navigation as being transferred from one RVH to another. |
| + // In this case the browser can recycle the old request once the new |
| + // renderer wants to navigate. Identifies the request ID of the old request. |
| + GlobalRequestID transferred_global_request_id; |
| + |
| + // Used in LOAD_TYPE_DATA loads only. Used for specifying a base URL |
| + // for pages loaded via data URLs. |
| + GURL base_url_for_data_url; |
| + |
| + // Used in LOAD_TYPE_DATA loads only. URL displayed to the user for |
| + // data loads. |
| + GURL virtual_url_for_data_url; |
| + |
| + // Used in LOAD_TYPE_BROWSER_INITIATED_HTTP_POST loads only. Carries the |
| + // post data of the load. |
| + base::RefCountedMemory* browser_initiated_post_data; |
|
boliu
2012/08/03 22:42:08
I thought about commenting about ownership of this
Charlie Reis
2012/08/03 23:12:48
I'd recommend the "ownership transferred to Naviga
boliu
2012/08/03 23:31:39
Done.
|
| + |
| + LoadURLParams(const GURL& url) |
| + : url(url), |
| + load_type(LOAD_TYPE_DEFAULT), |
| + transition_type(PAGE_TRANSITION_LINK), |
| + is_renderer_initiated(false), |
| + override_user_agent(UA_OVERRIDE_INHERIT), |
| + browser_initiated_post_data(NULL) { |
| + } |
| + }; |
| + |
| // Disables checking for a repost and prompting the user. This is used during |
| // testing. |
| CONTENT_EXPORT static void DisablePromptOnRepost(); |
| @@ -159,36 +241,9 @@ class NavigationController { |
| PageTransition type, |
| const std::string& extra_headers) = 0; |
| - // Same as LoadURL, but for renderer-initiated navigations. This state is |
| - // important for tracking whether to display pending URLs. |
| - virtual void LoadURLFromRenderer(const GURL& url, |
| - const Referrer& referrer, |
| - PageTransition type, |
| - const std::string& extra_headers) = 0; |
| - |
| - // Same as LoadURL, but allows overriding the user agent of the |
| - // NavigationEntry before it loads. |
| - // TODO(dfalcantara): Consolidate the LoadURL* interfaces. |
| - virtual void LoadURLWithUserAgentOverride(const GURL& url, |
| - const Referrer& referrer, |
| - PageTransition type, |
| - bool is_renderer_initiated, |
| - const std::string& extra_headers, |
| - bool is_overriding_user_agent) = 0; |
| - |
| - // Behaves like LoadURL() and LoadURLFromRenderer() but marks the new |
| - // navigation as being transferred from one RVH to another. In this case the |
| - // browser can recycle the old request once the new renderer wants to |
| - // navigate. |
| - // |transferred_global_request_id| identifies the request ID of the old |
| - // request. |
| - virtual void TransferURL( |
| - const GURL& url, |
| - const Referrer& referrer, |
| - PageTransition transition, |
| - const std::string& extra_headers, |
| - const GlobalRequestID& transferred_global_request_id, |
| - bool is_renderer_initiated) = 0; |
| + // More general version of LoadURL. See comments in LoadURLParams for |
| + // using |params|. |
| + virtual void LoadURLWithParams(LoadURLParams& params) = 0; |
| // Loads the current page if this NavigationController was restored from |
| // history and the current page has not loaded yet. |