OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The Safe Browsing service is responsible for downloading anti-phishing and | 5 // The Safe Browsing service is responsible for downloading anti-phishing and |
6 // anti-malware tables and checking urls against them. | 6 // anti-malware tables and checking urls against them. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 // multiple times during the life of the UIManager. Should be called | 62 // multiple times during the life of the UIManager. Should be called |
63 // on IO thread. If shutdown is true, the manager is disabled permanently. | 63 // on IO thread. If shutdown is true, the manager is disabled permanently. |
64 void StopOnIOThread(bool shutdown) override; | 64 void StopOnIOThread(bool shutdown) override; |
65 | 65 |
66 // Called on the IO thread by the ThreatDetails with the serialized | 66 // Called on the IO thread by the ThreatDetails with the serialized |
67 // protocol buffer, so the service can send it over. | 67 // protocol buffer, so the service can send it over. |
68 void SendSerializedThreatDetails(const std::string& serialized) override; | 68 void SendSerializedThreatDetails(const std::string& serialized) override; |
69 | 69 |
70 // Report hits to the unsafe contents (malware, phishing, unsafe download URL) | 70 // Report hits to the unsafe contents (malware, phishing, unsafe download URL) |
71 // to the server. Can only be called on UI thread. If |post_data| is | 71 // to the server. Can only be called on UI thread. If |post_data| is |
72 // non-empty, the request will be sent as a POST instead of a GET. | 72 // non-empty, the request will be sent as a POST instead of a GET. |
vakh (use Gerrit instead)
2017/05/19 22:41:13
I don't see the |post_data| argument to the functi
mortonm
2017/05/22 17:03:59
Done.
| |
73 // Will report only for UMA || is_extended_reporting. | 73 void MaybeReportSafeBrowsingHit(const safe_browsing::HitReport& hit_report, |
74 void MaybeReportSafeBrowsingHit( | 74 content::WebContents* web_contents) override; |
75 const safe_browsing::HitReport& hit_report) override; | |
76 | 75 |
77 // Report permission action to SafeBrowsing servers. Can only be called on UI | 76 // Report permission action to SafeBrowsing servers. Can only be called on UI |
78 // thread. | 77 // thread. |
79 void ReportPermissionAction(const PermissionReportInfo& report_info); | 78 void ReportPermissionAction(const PermissionReportInfo& report_info); |
80 | 79 |
81 // Creates the whitelist URL set for tests that create a blocking page | 80 // Creates the whitelist URL set for tests that create a blocking page |
82 // themselves and then simulate OnBlockingPageDone(). OnBlockingPageDone() | 81 // themselves and then simulate OnBlockingPageDone(). OnBlockingPageDone() |
83 // expects the whitelist to exist, but the tests don't necessarily call | 82 // expects the whitelist to exist, but the tests don't necessarily call |
84 // DisplayBlockingPage(), which creates it. | 83 // DisplayBlockingPage(), which creates it. |
85 static void CreateWhitelistForTesting(content::WebContents* web_contents); | 84 static void CreateWhitelistForTesting(content::WebContents* web_contents); |
(...skipping 15 matching lines...) Expand all Loading... | |
101 const safe_browsing::HitReport& hit_report) override; | 100 const safe_browsing::HitReport& hit_report) override; |
102 | 101 |
103 // Creates a hit report for the given resource and calls | 102 // Creates a hit report for the given resource and calls |
104 // MaybeReportSafeBrowsingHit. This also notifies all observers in | 103 // MaybeReportSafeBrowsingHit. This also notifies all observers in |
105 // |observer_list_|. | 104 // |observer_list_|. |
106 void CreateAndSendHitReport(const UnsafeResource& resource) override; | 105 void CreateAndSendHitReport(const UnsafeResource& resource) override; |
107 | 106 |
108 // Calls SafeBrowsingBlockingPage::ShowBlockingPage(). | 107 // Calls SafeBrowsingBlockingPage::ShowBlockingPage(). |
109 void ShowBlockingPageForResource(const UnsafeResource& resource) override; | 108 void ShowBlockingPageForResource(const UnsafeResource& resource) override; |
110 | 109 |
110 // Helper method to ensure hit reports are only sent when the user has | |
111 // opted in to extended reporting and is not currently in incognito mode. | |
112 static bool ShouldSendHitReport(const HitReport& hit_report, | |
113 content::WebContents* web_contents); | |
114 | |
111 private: | 115 private: |
112 friend class SafeBrowsingUIManagerTest; | 116 friend class SafeBrowsingUIManagerTest; |
113 friend class TestSafeBrowsingUIManager; | 117 friend class TestSafeBrowsingUIManager; |
114 | 118 |
115 // Report permission action to SafeBrowsing servers. | 119 // Report permission action to SafeBrowsing servers. |
116 void ReportPermissionActionOnIOThread( | 120 void ReportPermissionActionOnIOThread( |
117 const PermissionReportInfo& report_info); | 121 const PermissionReportInfo& report_info); |
118 | 122 |
119 static GURL GetMainFrameWhitelistUrlForResourceForTesting( | 123 static GURL GetMainFrameWhitelistUrlForResourceForTesting( |
120 const safe_browsing::SafeBrowsingUIManager::UnsafeResource& resource); | 124 const safe_browsing::SafeBrowsingUIManager::UnsafeResource& resource); |
121 | 125 |
122 // Safebrowsing service. | 126 // Safebrowsing service. |
123 scoped_refptr<SafeBrowsingService> sb_service_; | 127 scoped_refptr<SafeBrowsingService> sb_service_; |
124 | 128 |
125 base::ObserverList<Observer> observer_list_; | 129 base::ObserverList<Observer> observer_list_; |
126 | 130 |
127 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); | 131 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); |
128 }; | 132 }; |
129 | 133 |
130 } // namespace safe_browsing | 134 } // namespace safe_browsing |
131 | 135 |
132 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ | 136 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ |
OLD | NEW |