Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 IOS_CHROME_BROWSER_SSL_IOS_SSL_BLOCKING_PAGE_H_ | |
| 6 #define IOS_CHROME_BROWSER_SSL_IOS_SSL_BLOCKING_PAGE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "base/time/time.h" | |
| 14 #include "components/certificate_reporting/error_report.h" | |
| 15 #include "ios/chrome/browser/interstitials/ios_security_interstitial_page.h" | |
| 16 #include "net/ssl/ssl_info.h" | |
| 17 | |
| 18 class IOSChromeControllerClient; | |
| 19 class GURL; | |
| 20 | |
| 21 namespace ios { | |
| 22 class ChromeBrowserState; | |
| 23 } | |
| 24 | |
| 25 namespace security_interstitials { | |
| 26 class SSLErrorUI; | |
| 27 } | |
| 28 | |
| 29 // This class is responsible for showing/hiding the interstitial page that is | |
| 30 // shown when a certificate error happens. | |
| 31 // It deletes itself when the interstitial page is closed. | |
| 32 class IOSSSLBlockingPage : public IOSSecurityInterstitialPage { | |
|
droger
2016/01/06 17:21:23
Should it be IOSChromeSSLBlockingPage?
sdefresne
2016/01/06 17:31:02
Maybe, however superclass is also named IOSSecurit
droger
2016/01/06 17:34:00
Sure, that's fine.
| |
| 33 public: | |
| 34 ~IOSSSLBlockingPage() override; | |
| 35 | |
| 36 // Creates an SSL blocking page. If the blocking page isn't shown, the caller | |
| 37 // is responsible for cleaning up the blocking page, otherwise the | |
| 38 // interstitial takes ownership when shown. |options_mask| must be a bitwise | |
| 39 // mask of SSLErrorUI::SSLErrorOptionsMask values. | |
| 40 IOSSSLBlockingPage(web::WebState* web_state, | |
| 41 int cert_error, | |
| 42 const net::SSLInfo& ssl_info, | |
| 43 const GURL& request_url, | |
| 44 int options_mask, | |
| 45 const base::Time& time_triggered, | |
| 46 const base::Callback<void(bool)>& callback); | |
| 47 | |
| 48 protected: | |
| 49 // InterstitialPageDelegate implementation. | |
| 50 void CommandReceived(const std::string& command) override; | |
| 51 void OnProceed() override; | |
| 52 void OnDontProceed() override; | |
| 53 | |
| 54 // SecurityInterstitialPage implementation: | |
| 55 bool ShouldCreateNewNavigation() const override; | |
| 56 void PopulateInterstitialStrings( | |
| 57 base::DictionaryValue* load_time_data) const override; | |
| 58 void AfterShow() override; | |
| 59 | |
| 60 private: | |
| 61 void NotifyDenyCertificate(); | |
| 62 | |
| 63 // Returns true if |options_mask| refers to a soft-overridable SSL error. | |
| 64 static bool IsOverridable(int options_mask); | |
| 65 | |
| 66 base::Callback<void(bool)> callback_; | |
| 67 const net::SSLInfo ssl_info_; | |
| 68 const bool overridable_; // The UI allows the user to override the error. | |
| 69 | |
| 70 // The user previously allowed a bad certificate, but the decision has now | |
| 71 // expired. | |
| 72 const bool expired_but_previously_allowed_; | |
| 73 | |
| 74 scoped_ptr<IOSChromeControllerClient> controller_; | |
| 75 scoped_ptr<security_interstitials::SSLErrorUI> ssl_error_ui_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(IOSSSLBlockingPage); | |
| 78 }; | |
| 79 | |
| 80 #endif // IOS_CHROME_BROWSER_SSL_IOS_SSL_BLOCKING_PAGE_H_ | |
| OLD | NEW |