| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // PageNavigator defines an interface that can be used to express the user's | 5 // PageNavigator defines an interface that can be used to express the user's |
| 6 // intention to navigate to a particular URL. The implementing class should | 6 // intention to navigate to a particular URL. The implementing class should |
| 7 // perform the navigation. | 7 // perform the navigation. |
| 8 | 8 |
| 9 #ifndef CONTENT_PUBLIC_BROWSER_PAGE_NAVIGATOR_H_ | 9 #ifndef CONTENT_PUBLIC_BROWSER_PAGE_NAVIGATOR_H_ |
| 10 #define CONTENT_PUBLIC_BROWSER_PAGE_NAVIGATOR_H_ | 10 #define CONTENT_PUBLIC_BROWSER_PAGE_NAVIGATOR_H_ |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/ref_counted_memory.h" |
| 14 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/global_request_id.h" | 17 #include "content/public/browser/global_request_id.h" |
| 16 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
| 17 #include "content/public/common/referrer.h" | 19 #include "content/public/common/referrer.h" |
| 18 #include "ui/base/window_open_disposition.h" | 20 #include "ui/base/window_open_disposition.h" |
| 19 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 20 | 22 |
| 21 namespace content { | 23 namespace content { |
| 22 | 24 |
| 23 class WebContents; | 25 class WebContents; |
| 24 | 26 |
| 25 struct CONTENT_EXPORT OpenURLParams { | 27 struct CONTENT_EXPORT OpenURLParams { |
| 26 OpenURLParams(const GURL& url, | 28 OpenURLParams(const GURL& url, |
| 27 const Referrer& referrer, | 29 const Referrer& referrer, |
| 28 WindowOpenDisposition disposition, | 30 WindowOpenDisposition disposition, |
| 29 PageTransition transition, | 31 PageTransition transition, |
| 30 bool is_renderer_initiated); | 32 bool is_renderer_initiated); |
| 31 OpenURLParams(const GURL& url, | 33 OpenURLParams(const GURL& url, |
| 32 const Referrer& referrer, | 34 const Referrer& referrer, |
| 33 int64 source_frame_id, | 35 int64 source_frame_id, |
| 34 WindowOpenDisposition disposition, | 36 WindowOpenDisposition disposition, |
| 35 PageTransition transition, | 37 PageTransition transition, |
| 36 bool is_renderer_initiated); | 38 bool is_renderer_initiated); |
| 37 ~OpenURLParams(); | 39 ~OpenURLParams(); |
| 38 | 40 |
| 39 // The URL/referrer to be opened. | 41 // The URL/referrer to be opened. |
| 40 GURL url; | 42 GURL url; |
| 41 Referrer referrer; | 43 Referrer referrer; |
| 42 | 44 |
| 45 // Indicates whether this navigation will be sent using POST. |
| 46 // The POST method is limited support for basic POST data by leveraging |
| 47 // NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST. |
| 48 // It is not for things like file uploads. |
| 49 bool uses_post; |
| 50 |
| 51 // The post data when the navigation uses POST. |
| 52 scoped_refptr<base::RefCountedMemory> browser_initiated_post_data; |
| 53 |
| 43 // Extra headers to add to the request for this page. Headers are | 54 // Extra headers to add to the request for this page. Headers are |
| 44 // represented as "<name>: <value>" and separated by \r\n. The entire string | 55 // represented as "<name>: <value>" and separated by \r\n. The entire string |
| 45 // is terminated by \r\n. May be empty if no extra headers are needed. | 56 // is terminated by \r\n. May be empty if no extra headers are needed. |
| 46 std::string extra_headers; | 57 std::string extra_headers; |
| 47 | 58 |
| 48 // The source frame id or -1 to indicate the main frame. | 59 // The source frame id or -1 to indicate the main frame. |
| 49 int64 source_frame_id; | 60 int64 source_frame_id; |
| 50 | 61 |
| 51 // The disposition requested by the navigation source. | 62 // The disposition requested by the navigation source. |
| 52 WindowOpenDisposition disposition; | 63 WindowOpenDisposition disposition; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 80 public: | 91 public: |
| 81 virtual ~PageNavigator() {} | 92 virtual ~PageNavigator() {} |
| 82 | 93 |
| 83 // Opens a URL with the given disposition. The transition specifies how this | 94 // Opens a URL with the given disposition. The transition specifies how this |
| 84 // navigation should be recorded in the history system (for example, typed). | 95 // navigation should be recorded in the history system (for example, typed). |
| 85 // Returns the WebContents the URL is opened in, or NULL if the URL wasn't | 96 // Returns the WebContents the URL is opened in, or NULL if the URL wasn't |
| 86 // opened immediately. | 97 // opened immediately. |
| 87 virtual WebContents* OpenURL(const OpenURLParams& params) = 0; | 98 virtual WebContents* OpenURL(const OpenURLParams& params) = 0; |
| 88 }; | 99 }; |
| 89 | 100 |
| 90 } | 101 } // namespace content |
| 91 | 102 |
| 92 #endif // CONTENT_PUBLIC_BROWSER_PAGE_NAVIGATOR_H_ | 103 #endif // CONTENT_PUBLIC_BROWSER_PAGE_NAVIGATOR_H_ |
| OLD | NEW |