Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/ssl/chrome_security_state_model_client.h

Issue 2448943002: Refactor SecurityStateModel/Clients for simplicity and reusability. (Closed)
Patch Set: refactor -> SecurityStateTabHelper. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_CHROME_SECURITY_STATE_MODEL_CLIENT_H_
6 #define CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "components/security_state/security_state_model.h"
12 #include "components/security_state/security_state_model_client.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h"
15 #include "third_party/WebKit/public/platform/WebSecurityStyle.h"
16
17 namespace content {
18 struct SecurityStyleExplanations;
19 class NavigationHandle;
20 class WebContents;
21 } // namespace content
22
23 // Uses a WebContents to provide a SecurityStateModel with the
24 // information that it needs to determine the page's security status.
25 class ChromeSecurityStateModelClient
26 : public security_state::SecurityStateModelClient,
27 public content::WebContentsObserver,
28 public content::WebContentsUserData<ChromeSecurityStateModelClient> {
29 public:
30 ~ChromeSecurityStateModelClient() override;
31
32 void GetSecurityInfo(
33 security_state::SecurityStateModel::SecurityInfo* result) const;
34
35 // Called when the NavigationEntry's SSLStatus or other security
36 // information changes.
37 void VisibleSecurityStateChanged();
38
39 // content::WebContentsObserver:
40 void DidFinishNavigation(
41 content::NavigationHandle* navigation_handle) override;
42
43 // Returns the SecurityStyle that should be applied to a WebContents
44 // with the given |security_info|. Populates
45 // |security_style_explanations| to explain why the returned
46 // SecurityStyle was chosen.
47 static blink::WebSecurityStyle GetSecurityStyle(
48 const security_state::SecurityStateModel::SecurityInfo& security_info,
49 content::SecurityStyleExplanations* security_style_explanations);
50
51 // SecurityStateModelClient:
52 void GetVisibleSecurityState(
53 security_state::SecurityStateModel::VisibleSecurityState* state) override;
54 bool UsedPolicyInstalledCertificate() override;
55 bool IsOriginSecure(const GURL& url) override;
56
57 private:
58 explicit ChromeSecurityStateModelClient(content::WebContents* web_contents);
59 friend class content::WebContentsUserData<ChromeSecurityStateModelClient>;
60
61 content::WebContents* web_contents_;
62 std::unique_ptr<security_state::SecurityStateModel> security_state_model_;
63
64 // True if a console has been logged about an omnibox warning that
65 // will be shown in future versions of Chrome for insecure HTTP
66 // pages. This message should only be logged once per main-frame
67 // navigation.
68 bool logged_http_warning_on_current_navigation_;
69
70 DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClient);
71 };
72
73 #endif // CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698