Chromium Code Reviews| 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_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 class NavigationEntry; | 14 class NavigationEntry; |
| 15 struct RendererPreferences; | 15 struct RendererPreferences; |
| 16 | 16 |
| 17 // Controls and provides the html for an interstitial page. The delegate is | 17 // Controls and provides the html for an interstitial page. The delegate is |
| 18 // owned by the InterstitialPage. | 18 // owned by the InterstitialPage. |
| 19 class InterstitialPageDelegate { | 19 class CONTENT_EXPORT InterstitialPageDelegate { |
| 20 public: | 20 public: |
| 21 // An identifier used to identify an InterstitialPage. | |
| 22 typedef const void* TypeID; | |
| 23 | |
| 21 virtual ~InterstitialPageDelegate() {} | 24 virtual ~InterstitialPageDelegate() {} |
| 22 | 25 |
| 23 // Return the HTML that should be displayed in the page. | 26 // Return the HTML that should be displayed in the page. |
| 24 virtual std::string GetHTMLContents() = 0; | 27 virtual std::string GetHTMLContents() = 0; |
| 25 | 28 |
| 26 // Called when the interstitial is proceeded or cancelled. Note that this may | 29 // Called when the interstitial is proceeded or cancelled. Note that this may |
| 27 // be called by content directly even if the embedder didn't call Proceed or | 30 // be called by content directly even if the embedder didn't call Proceed or |
| 28 // DontProceed on InterstitialPage, since navigations etc may cancel them. | 31 // DontProceed on InterstitialPage, since navigations etc may cancel them. |
| 29 virtual void OnProceed() {} | 32 virtual void OnProceed() {} |
| 30 virtual void OnDontProceed() {} | 33 virtual void OnDontProceed() {} |
| 31 | 34 |
| 32 // Invoked when the page sent a command through DOMAutomation. | 35 // Invoked when the page sent a command through DOMAutomation. |
| 33 virtual void CommandReceived(const std::string& command) {} | 36 virtual void CommandReceived(const std::string& command) {} |
| 34 | 37 |
| 35 // Invoked with the NavigationEntry that is going to be added to the | 38 // Invoked with the NavigationEntry that is going to be added to the |
| 36 // navigation controller. | 39 // navigation controller. |
| 37 // Gives an opportunity to delegates to set states on the |entry|. | 40 // Gives an opportunity to delegates to set states on the |entry|. |
| 38 // Note that this is only called if the InterstitialPage was constructed with | 41 // Note that this is only called if the InterstitialPage was constructed with |
| 39 // |new_navigation| set to true. | 42 // |new_navigation| set to true. |
| 40 virtual void OverrideEntry(content::NavigationEntry* entry) {} | 43 virtual void OverrideEntry(content::NavigationEntry* entry) {} |
| 41 | 44 |
| 42 // Allows the delegate to override the renderer preferences structure that's | 45 // Allows the delegate to override the renderer preferences structure that's |
| 43 // sent to the new RenderViewHost. | 46 // sent to the new RenderViewHost. |
| 44 virtual void OverrideRendererPrefs(content::RendererPreferences* prefs) {} | 47 virtual void OverrideRendererPrefs(content::RendererPreferences* prefs) {} |
| 48 | |
| 49 // Return the interstitial type for testing. | |
| 50 virtual TypeID GetTypeForTesting() const; | |
|
Bernhard Bauer
2015/03/03 09:56:00
Do you really want to provide a default implementa
meacer
2015/03/03 18:33:05
I started with a pure virtual method, but turns ou
Bernhard Bauer
2015/03/03 21:40:51
I'm more worried about the classes that are not te
| |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 } // namespace content | 53 } // namespace content |
| 48 | 54 |
| 49 #endif // CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_DELEGATE_H_ | 55 #endif // CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_DELEGATE_H_ |
| OLD | NEW |