OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
| 6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
| 7 |
| 8 #include "base/strings/string16.h" |
| 9 #include "content/public/browser/interstitial_page_delegate.h" |
| 10 #include "url/gurl.h" |
| 11 |
| 12 namespace base { |
| 13 class DictionaryValue; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 class InterstitialPage; |
| 18 class WebContents; |
| 19 } |
| 20 |
| 21 class SecurityInterstitialPage : public content::InterstitialPageDelegate { |
| 22 public: |
| 23 SecurityInterstitialPage(content::WebContents* web_contents, |
| 24 const GURL& url); |
| 25 virtual ~SecurityInterstitialPage(); |
| 26 |
| 27 // Creates an interstitial and shows it. |
| 28 virtual void Show(); |
| 29 |
| 30 // Returns interstitial type for testing. |
| 31 virtual const void* GetTypeForTesting() const = 0; |
| 32 |
| 33 // Prevents creating the actual interstitial view for testing. |
| 34 void DontCreateViewForTesting(); |
| 35 |
| 36 protected: |
| 37 // Returns true if the interstitial should create a new navigation entry. |
| 38 virtual bool ShouldCreateNewNavigation() const = 0; |
| 39 |
| 40 // Populates the strings used to generate the HTML from the template. |
| 41 virtual void PopulateInterstitialStrings( |
| 42 base::DictionaryValue* load_time_data) = 0; |
| 43 |
| 44 // InterstitialPageDelegate method: |
| 45 std::string GetHTMLContents() override; |
| 46 |
| 47 // Returns the formatted host name for the request url. |
| 48 base::string16 GetFormattedHostName() const; |
| 49 |
| 50 content::InterstitialPage* interstitial_page() const; |
| 51 content::WebContents* web_contents() const; |
| 52 GURL request_url() const; |
| 53 |
| 54 private: |
| 55 content::WebContents* web_contents_; |
| 56 const GURL request_url_; |
| 57 // Once shown, |interstitial_page| takes ownership of this |
| 58 // SecurityInterstitialPage instance. |
| 59 content::InterstitialPage* interstitial_page_; |
| 60 // Whether the interstitial should create a view. |
| 61 bool create_view_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); |
| 64 }; |
| 65 |
| 66 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
OLD | NEW |