| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ |
| 6 #define CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ | 6 #define CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/security_state/security_state_model.h" | 11 #include "components/security_state/security_state_model.h" |
| 12 #include "components/security_state/security_state_model_client.h" | 12 #include "components/security_state/security_state_model_client.h" |
| 13 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
| 14 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" | 15 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 struct SecurityStyleExplanations; | 18 struct SecurityStyleExplanations; |
| 18 class WebContents; | 19 class WebContents; |
| 19 } // namespace content | 20 } // namespace content |
| 20 | 21 |
| 21 // Uses a WebContents to provide a SecurityStateModel with the | 22 // Uses a WebContents to provide a SecurityStateModel with the |
| 22 // information that it needs to determine the page's security status. | 23 // information that it needs to determine the page's security status. |
| 23 class ChromeSecurityStateModelClient | 24 class ChromeSecurityStateModelClient |
| 24 : public security_state::SecurityStateModelClient, | 25 : public security_state::SecurityStateModelClient, |
| 25 public content::WebContentsUserData<ChromeSecurityStateModelClient> { | 26 public content::WebContentsUserData<ChromeSecurityStateModelClient>, |
| 27 public content::WebContentsObserver { |
| 26 public: | 28 public: |
| 27 ~ChromeSecurityStateModelClient() override; | 29 ~ChromeSecurityStateModelClient() override; |
| 28 | 30 |
| 29 void GetSecurityInfo( | 31 void GetSecurityInfo( |
| 30 security_state::SecurityStateModel::SecurityInfo* result) const; | 32 security_state::SecurityStateModel::SecurityInfo* result) const; |
| 31 | 33 |
| 32 // Returns the SecurityStyle that should be applied to a WebContents | 34 // Returns the SecurityStyle that should be applied to a WebContents |
| 33 // with the given |security_info|. Populates | 35 // with the given |security_info|. Populates |
| 34 // |security_style_explanations| to explain why the returned | 36 // |security_style_explanations| to explain why the returned |
| 35 // SecurityStyle was chosen. | 37 // SecurityStyle was chosen. |
| 36 static blink::WebSecurityStyle GetSecurityStyle( | 38 static blink::WebSecurityStyle GetSecurityStyle( |
| 37 const security_state::SecurityStateModel::SecurityInfo& security_info, | 39 const security_state::SecurityStateModel::SecurityInfo& security_info, |
| 38 content::SecurityStyleExplanations* security_style_explanations); | 40 content::SecurityStyleExplanations* security_style_explanations); |
| 39 | 41 |
| 40 // SecurityStateModelClient: | 42 // SecurityStateModelClient: |
| 41 void GetVisibleSecurityState( | 43 void GetVisibleSecurityState( |
| 42 security_state::SecurityStateModel::VisibleSecurityState* state) override; | 44 security_state::SecurityStateModel::VisibleSecurityState* state) override; |
| 43 bool UsedPolicyInstalledCertificate() override; | 45 bool UsedPolicyInstalledCertificate() override; |
| 44 bool IsOriginSecure(const GURL& url) override; | 46 bool IsOriginSecure(const GURL& url) override; |
| 45 | 47 |
| 48 // content::WebContentsObserver: |
| 49 void DidFinishNavigation( |
| 50 content::NavigationHandle* navigation_handle) override; |
| 51 |
| 46 private: | 52 private: |
| 47 explicit ChromeSecurityStateModelClient(content::WebContents* web_contents); | 53 explicit ChromeSecurityStateModelClient(content::WebContents* web_contents); |
| 48 friend class content::WebContentsUserData<ChromeSecurityStateModelClient>; | 54 friend class content::WebContentsUserData<ChromeSecurityStateModelClient>; |
| 49 | 55 |
| 50 content::WebContents* web_contents_; | 56 content::WebContents* web_contents_; |
| 51 std::unique_ptr<security_state::SecurityStateModel> security_state_model_; | 57 std::unique_ptr<security_state::SecurityStateModel> security_state_model_; |
| 58 mutable bool logged_http_warning_on_current_navigation_; |
| 52 | 59 |
| 53 DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClient); | 60 DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClient); |
| 54 }; | 61 }; |
| 55 | 62 |
| 56 #endif // CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ | 63 #endif // CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ |
| OLD | NEW |