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 COMPONENTS_SECURITY_STATE_CONTENT_WEB_CONTENTS_SECURITY_STATE_MODEL_H_ |
| 6 #define COMPONENTS_SECURITY_STATE_CONTENT_WEB_CONTENTS_SECURITY_STATE_MODEL_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "components/security_state/core/security_state_model.h" |
| 12 #include "components/security_state/core/security_state_model_client.h" |
| 13 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" |
| 14 |
| 15 namespace content { |
| 16 class NavigationEntry; |
| 17 struct SecurityStyleExplanations; |
| 18 class WebContents; |
| 19 } |
| 20 |
| 21 namespace security_state { |
| 22 |
| 23 // Provides embedder-specific information to a WebContentsSecurityStateModel. |
| 24 class WebContentsSecurityStateModelClient { |
| 25 public: |
| 26 // Returns true if the page or request is known to be loaded with a |
| 27 // certificate installed by the system administrator. |
| 28 virtual bool UsedPolicyInstalledCertificate() = 0; |
| 29 |
| 30 // Returns true if the given NavigationEntry fails the malware check. |
| 31 virtual bool GetMalwareStatus(content::NavigationEntry* entry, |
| 32 content::WebContents* web_contents) = 0; |
| 33 }; |
| 34 |
| 35 // Uses a WebContents and a WebContentsSecurityStateModelClient to provide a |
| 36 // SecurityStateModel with the information that it needs to determine the page's |
| 37 // security status. |
| 38 class WebContentsSecurityStateModel { |
| 39 public: |
| 40 explicit WebContentsSecurityStateModel( |
| 41 content::WebContents* web_contents); |
| 42 virtual ~WebContentsSecurityStateModel(); |
| 43 |
| 44 void SetClient(WebContentsSecurityStateModelClient* client); |
| 45 |
| 46 // Populates |result| to describe the current page. |
| 47 void GetSecurityInfo(SecurityStateModel::SecurityInfo* result) const; |
| 48 |
| 49 // Retrieves the visible security state that is relevant to the |
| 50 // SecurityStateModel. |
| 51 void GetVisibleSecurityState(SecurityStateModel::VisibleSecurityState* state); |
| 52 |
| 53 // Returns the SecurityStyle that should be applied to a WebContents |
| 54 // with the given |security_info|. Populates |
| 55 // |security_style_explanations| to explain why the returned |
| 56 // SecurityStyle was chosen. |
| 57 static blink::WebSecurityStyle GetSecurityStyle( |
| 58 const SecurityStateModel::SecurityInfo& security_info, |
| 59 content::SecurityStyleExplanations* security_style_explanations); |
| 60 |
| 61 private: |
| 62 content::WebContents* web_contents_; |
| 63 std::unique_ptr<SecurityStateModel> security_state_model_; |
| 64 |
| 65 WebContentsSecurityStateModelClient* client_; |
| 66 |
| 67 class Client; |
| 68 std::unique_ptr<Client> internal_client_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(WebContentsSecurityStateModel); |
| 71 }; |
| 72 |
| 73 } // namespace security_state |
| 74 |
| 75 #endif // COMPONENTS_SECURITY_STATE_CONTENT_WEB_CONTENTS_SECURITY_STATE_MODEL_H
_ |
OLD | NEW |