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