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