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 #ifndef CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 | 9 |
10 class GURL; | 10 class GURL; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 WebContents* web_contents, | 46 WebContents* web_contents, |
47 bool new_navigation, | 47 bool new_navigation, |
48 const GURL& url, | 48 const GURL& url, |
49 InterstitialPageDelegate* delegate); | 49 InterstitialPageDelegate* delegate); |
50 | 50 |
51 // Retrieves the InterstitialPage if any associated with the specified | 51 // Retrieves the InterstitialPage if any associated with the specified |
52 // |web_contents|. | 52 // |web_contents|. |
53 CONTENT_EXPORT static InterstitialPage* GetInterstitialPage( | 53 CONTENT_EXPORT static InterstitialPage* GetInterstitialPage( |
54 WebContents* web_contents); | 54 WebContents* web_contents); |
55 | 55 |
56 // Retrieves the InterstitialPage that hosts the RenderFrameHost, or nullptr | |
57 // if |rfh| is not a part of any InterstitialPage. | |
58 CONTENT_EXPORT static InterstitialPage* FromRenderFrameHost( | |
59 RenderFrameHost* rfh); | |
60 | |
56 virtual ~InterstitialPage() {} | 61 virtual ~InterstitialPage() {} |
57 | 62 |
58 // Shows the interstitial page in the tab. | 63 // Shows the interstitial page in the tab. |
59 virtual void Show() = 0; | 64 virtual void Show() = 0; |
60 | 65 |
61 // Hides the interstitial page. | 66 // Hides the interstitial page. |
62 virtual void Hide() = 0; | 67 virtual void Hide() = 0; |
63 | 68 |
64 // Reverts to the page showing before the interstitial. | 69 // Reverts to the page showing before the interstitial. |
65 // Delegates should call this method when the user has chosen NOT to proceed | 70 // Delegates should call this method when the user has chosen NOT to proceed |
66 // to the target URL. | 71 // to the target URL. |
67 // Warning: if |new_navigation| was set to true in the constructor, 'this' | 72 // Warning: if |new_navigation| was set to true in the constructor, 'this' |
68 // will be deleted when this method returns. | 73 // will be deleted when this method returns. |
69 virtual void DontProceed() = 0; | 74 virtual void DontProceed() = 0; |
70 | 75 |
71 // Delegates should call this method when the user has chosen to proceed to | 76 // Delegates should call this method when the user has chosen to proceed to |
72 // the target URL. | 77 // the target URL. |
73 // Warning: 'this' has been deleted when this method returns. | 78 // Warning: 'this' has been deleted when this method returns. |
74 virtual void Proceed() = 0; | 79 virtual void Proceed() = 0; |
75 | 80 |
76 // Sizes the RenderViewHost showing the actual interstitial page contents. | 81 // Sizes the RenderViewHost showing the actual interstitial page contents. |
77 virtual void SetSize(const gfx::Size& size) = 0; | 82 virtual void SetSize(const gfx::Size& size) = 0; |
78 | 83 |
79 // Sets the focus to the interstitial. | 84 // Sets the focus to the interstitial. |
80 virtual void Focus() = 0; | 85 virtual void Focus() = 0; |
81 | 86 |
87 // Get the WebContents in which this interstitial is shown. Warning: Frames | |
88 // in the intersitital are NOT visible through WebContentObservers' normal | |
89 // notificaions (e.g. RenderFrameDeleted). The only sensible use of this | |
Charlie Reis
2016/01/26 01:14:30
nit: notifications
robwu
2016/01/26 11:29:32
Done.
| |
90 // returned WebContents is to add a WebContentObserver and listen for the | |
91 // DidAttachInterstitialPage or DidDetachInterstitialPage notifications. | |
92 virtual WebContents* GetUnderlyingWebContents() const = 0; | |
Charlie Reis
2016/01/26 01:14:30
Underlying isn't a term we use elsewhere for inter
robwu
2016/01/26 11:29:32
Done. (I called it GetUnderlyingWebContents becaus
Charlie Reis
2016/01/26 23:58:27
Ah, I was mistaken. But yeah, that's hidden away
| |
93 | |
82 // Gets the RenderFrameHost associated with | 94 // Gets the RenderFrameHost associated with |
83 // the interstitial page's main frame. | 95 // the interstitial page's main frame. |
84 virtual RenderFrameHost* GetMainFrame() const = 0; | 96 virtual RenderFrameHost* GetMainFrame() const = 0; |
85 | 97 |
86 virtual InterstitialPageDelegate* GetDelegateForTesting() = 0; | 98 virtual InterstitialPageDelegate* GetDelegateForTesting() = 0; |
87 virtual void DontCreateViewForTesting() = 0; | 99 virtual void DontCreateViewForTesting() = 0; |
88 }; | 100 }; |
89 | 101 |
90 } // namespace content | 102 } // namespace content |
91 | 103 |
92 #endif // CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_ | 104 #endif // CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_ |
OLD | NEW |