Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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_SSL_SECURITY_STATE_TAB_HELPER_H_ | |
| 6 #define CHROME_BROWSER_SSL_SECURITY_STATE_TAB_HELPER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "components/security_state/core/security_state_model.h" | |
| 12 #include "content/public/browser/web_contents_observer.h" | |
| 13 #include "content/public/browser/web_contents_user_data.h" | |
| 14 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" | |
| 15 | |
| 16 namespace content { | |
| 17 struct SecurityStyleExplanations; | |
| 18 class NavigationHandle; | |
| 19 class WebContents; | |
| 20 } // namespace content | |
| 21 | |
| 22 // Tab helper that uses a SecurityStateModel to provide the page's security | |
| 23 // status. Also logs console warnings for private data on insecure pages. | |
| 24 class SecurityStateTabHelper | |
| 25 : public content::WebContentsObserver, | |
| 26 public content::WebContentsUserData<SecurityStateTabHelper> { | |
| 27 public: | |
| 28 ~SecurityStateTabHelper() override; | |
| 29 | |
| 30 // See SecurityStateModel::GetSecurityInfo. | |
| 31 void GetSecurityInfo( | |
| 32 security_state::SecurityStateModel::SecurityInfo* result) const; | |
| 33 | |
| 34 // Called when the NavigationEntry's SSLStatus or other security | |
| 35 // information changes. | |
| 36 void VisibleSecurityStateChanged(); | |
| 37 | |
| 38 // content::WebContentsObserver: | |
| 39 void DidFinishNavigation( | |
| 40 content::NavigationHandle* navigation_handle) override; | |
| 41 | |
| 42 private: | |
| 43 explicit SecurityStateTabHelper(content::WebContents* web_contents); | |
| 44 friend class content::WebContentsUserData<SecurityStateTabHelper>; | |
| 45 | |
| 46 bool UsedPolicyInstalledCertificate() const; | |
| 47 bool GetMalwareStatus() const; | |
| 48 std::unique_ptr<security_state::SecurityStateModel::VisibleSecurityState> | |
| 49 GetVisibleSecurityState() const; | |
| 50 | |
| 51 std::unique_ptr<security_state::SecurityStateModel> model_; | |
|
estark
2016/11/03 04:38:45
nit: could probably just be a SecurityStateModel,
Eric Seckler
2016/11/03 17:01:06
no longer necessary :)
| |
| 52 | |
| 53 // True if a console message has been logged about an omnibox warning that | |
| 54 // will be shown in future versions of Chrome for insecure HTTP pages. This | |
| 55 // message should only be logged once per main-frame navigation. | |
| 56 bool logged_http_warning_on_current_navigation_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(SecurityStateTabHelper); | |
| 59 }; | |
| 60 | |
| 61 #endif // CHROME_BROWSER_SSL_SECURITY_STATE_TAB_HELPER_H_ | |
| OLD | NEW |