OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 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 "chrome/browser/password_manager/password_manager_util.h" | |
6 | |
7 #include "base/strings/string_util.h" | |
8 | |
9 namespace password_manager_util { | |
10 | |
11 bool IsDomainNameMonitored(const std::string& url_host, | |
12 std::string* domain_name) { | |
13 const char *kMonitoredDomainName[] = { | |
Ilya Sherman
2013/08/29 06:42:21
nit: "char*" (swap the position of the asterisk an
jdomingos
2013/08/30 21:09:20
Done.
| |
14 "google.com", | |
15 "yahoo.com", | |
16 "baidu.com", | |
17 "wikipedia.org", | |
18 "linkedin.com", | |
19 "twitter.com", | |
20 "live.com", | |
21 "amazon.com", | |
22 }; | |
Ilya Sherman
2013/08/29 06:42:21
Oof, this seems really questionable from a privacy
vabr (Chromium)
2013/08/29 08:15:13
I can confirm that somebody other than me will be
Ilya Sherman
2013/08/29 22:42:43
I'm not comfortable approving this change prior to
| |
23 const size_t kMonitoredDomainNameLength = arraysize(kMonitoredDomainName); | |
24 | |
25 domain_name->clear(); | |
26 | |
27 for (std::string::size_type i = 0; i < kMonitoredDomainNameLength; ++i) { | |
Ilya Sherman
2013/08/29 06:42:21
nit: You can just use size_t rather than std::stri
jdomingos
2013/08/30 21:09:20
Done.
| |
28 size_t point_position = | |
29 url_host.size() - strlen(kMonitoredDomainName[i]) - 1; | |
30 | |
31 if (url_host == kMonitoredDomainName[i] || | |
32 (EndsWith(url_host, kMonitoredDomainName[i], true) && | |
33 url_host[point_position] == '.')) { | |
Ilya Sherman
2013/08/29 06:42:21
Please use the GURL and url_parse::Parsed classes
jdomingos
2013/08/30 21:09:20
I don't understand what you want me to do here.
Co
| |
34 *domain_name = kMonitoredDomainName[i]; | |
35 return true; | |
36 } | |
37 } | |
38 return false; | |
39 } | |
40 | |
41 } // namespace password_manager_util | |
OLD | NEW |