OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 #include "components/safe_browsing/password_protection/password_protection_servi ce.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/callback.h" | |
9 #include "base/metrics/histogram_macros.h" | |
10 #include "components/safe_browsing_db/database_manager.h" | |
11 #include "content/public/browser/browser_thread.h" | |
12 | |
13 using content::BrowserThread; | |
14 | |
15 namespace safe_browsing { | |
16 | |
17 PasswordProtectionService::PasswordProtectionService( | |
18 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager) | |
19 : database_manager_(database_manager) {} | |
vakh (use Gerrit instead)
2017/03/01 23:25:19
Can the constructor be called on any thread?
Jialiu Lin
2017/03/02 00:53:06
In theory, it will only be created on UI thread du
| |
20 | |
21 PasswordProtectionService::~PasswordProtectionService() {} | |
22 | |
23 void PasswordProtectionService::RecordPasswordReuse(const GURL& url) { | |
24 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
25 DCHECK(database_manager_); | |
26 if (!url.is_valid()) | |
27 return; | |
28 | |
29 BrowserThread::PostTaskAndReplyWithResult( | |
30 BrowserThread::IO, FROM_HERE, | |
31 base::Bind(&SafeBrowsingDatabaseManager::MatchCsdWhitelistUrl, | |
32 database_manager_, url), | |
33 base::Bind(&PasswordProtectionService::OnMatchCsdWhiteListResult, this)); | |
34 } | |
35 | |
36 void PasswordProtectionService::OnMatchCsdWhiteListResult( | |
37 bool match_whitelist) { | |
38 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
39 UMA_HISTOGRAM_BOOLEAN( | |
40 "PasswordManager.PasswordReuse.MainFrameMatchCsdWhitelist", | |
41 match_whitelist); | |
42 } | |
43 | |
44 } // namespace safe_browsing | |
OLD | NEW |