Chromium Code Reviews| Index: chrome/browser/password_manager/password_manager_util.cc |
| diff --git a/chrome/browser/password_manager/password_manager_util.cc b/chrome/browser/password_manager/password_manager_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a31c4086466aa8ed3248f6b3b5432f00999e977e |
| --- /dev/null |
| +++ b/chrome/browser/password_manager/password_manager_util.cc |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/password_manager/password_manager_util.h" |
| + |
| +#include "base/strings/string_util.h" |
| + |
| +namespace password_manager_util { |
| + |
| +bool IsDomainNameMonitored(const std::string& url_host, |
| + std::string* domain_name) { |
| + 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.
|
| + "google.com", |
| + "yahoo.com", |
| + "baidu.com", |
| + "wikipedia.org", |
| + "linkedin.com", |
| + "twitter.com", |
| + "live.com", |
| + "amazon.com", |
| + }; |
|
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
|
| + const size_t kMonitoredDomainNameLength = arraysize(kMonitoredDomainName); |
| + |
| + domain_name->clear(); |
| + |
| + 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.
|
| + size_t point_position = |
| + url_host.size() - strlen(kMonitoredDomainName[i]) - 1; |
| + |
| + if (url_host == kMonitoredDomainName[i] || |
| + (EndsWith(url_host, kMonitoredDomainName[i], true) && |
| + 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
|
| + *domain_name = kMonitoredDomainName[i]; |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| +} // namespace password_manager_util |