OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_ | 9 #ifndef CONTENT_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_ |
10 #define CONTENT_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_ | 10 #define CONTENT_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
| 15 #include "content/browser/renderer_host/global_request_id.h" |
15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
16 #include "content/public/common/page_transition_types.h" | 17 #include "content/public/common/page_transition_types.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 #include "webkit/glue/window_open_disposition.h" | 19 #include "webkit/glue/window_open_disposition.h" |
19 | 20 |
20 class TabContents; | 21 class TabContents; |
21 | 22 |
22 struct CONTENT_EXPORT OpenURLParams { | 23 struct CONTENT_EXPORT OpenURLParams { |
23 OpenURLParams(const GURL& url, | 24 OpenURLParams(const GURL& url, |
24 const GURL& referrer, | 25 const GURL& referrer, |
25 WindowOpenDisposition disposition, | 26 WindowOpenDisposition disposition, |
26 content::PageTransition transition, | 27 content::PageTransition transition, |
27 bool is_renderer_initiated); | 28 bool is_renderer_initiated); |
28 ~OpenURLParams(); | 29 ~OpenURLParams(); |
29 class TabContents; | |
30 | 30 |
31 // The URL/referrer to be opened. | 31 // The URL/referrer to be opened. |
32 GURL url; | 32 GURL url; |
33 GURL referrer; | 33 GURL referrer; |
34 | 34 |
35 // The disposition requested by the navigation source. | 35 // The disposition requested by the navigation source. |
36 WindowOpenDisposition disposition; | 36 WindowOpenDisposition disposition; |
37 | 37 |
38 // The transition type of navigation. | 38 // The transition type of navigation. |
39 content::PageTransition transition; | 39 content::PageTransition transition; |
40 | 40 |
41 // Whether this navigation is initiated by the renderer process. | 41 // Whether this navigation is initiated by the renderer process. |
42 bool is_renderer_initiated; | 42 bool is_renderer_initiated; |
43 | 43 |
44 // The override encoding of the URL contents to be opened. | 44 // The override encoding of the URL contents to be opened. |
45 std::string override_encoding; | 45 std::string override_encoding; |
46 | 46 |
| 47 // Reference to the old request id in case this is a navigation that is being |
| 48 // transferred to a new renderer. |
| 49 GlobalRequestID transferred_global_request_id; |
| 50 |
47 private: | 51 private: |
48 OpenURLParams(); | 52 OpenURLParams(); |
49 }; | 53 }; |
50 | 54 |
51 class CONTENT_EXPORT PageNavigator { | 55 class CONTENT_EXPORT PageNavigator { |
52 public: | 56 public: |
53 // Deprecated. Please use the one-argument variant instead. | 57 // Deprecated. Please use the one-argument variant instead. |
54 // TODO(adriansc): Remove this method when refactoring changed all call sites. | 58 // TODO(adriansc): Remove this method when refactoring changed all call sites. |
55 virtual TabContents* OpenURL(const GURL& url, | 59 virtual TabContents* OpenURL(const GURL& url, |
56 const GURL& referrer, | 60 const GURL& referrer, |
57 WindowOpenDisposition disposition, | 61 WindowOpenDisposition disposition, |
58 content::PageTransition transition) = 0; | 62 content::PageTransition transition) = 0; |
59 | 63 |
60 // Opens a URL with the given disposition. The transition specifies how this | 64 // Opens a URL with the given disposition. The transition specifies how this |
61 // navigation should be recorded in the history system (for example, typed). | 65 // navigation should be recorded in the history system (for example, typed). |
62 // Returns the TabContents the URL is opened in, or NULL if the URL wasn't | 66 // Returns the TabContents the URL is opened in, or NULL if the URL wasn't |
63 // opened immediately. | 67 // opened immediately. |
64 virtual TabContents* OpenURL(const OpenURLParams& params) = 0; | 68 virtual TabContents* OpenURL(const OpenURLParams& params) = 0; |
65 | 69 |
66 protected: | 70 protected: |
67 virtual ~PageNavigator() {} | 71 virtual ~PageNavigator() {} |
68 }; | 72 }; |
69 | 73 |
70 #endif // CONTENT_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_ | 74 #endif // CONTENT_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_ |
OLD | NEW |