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

Unified Diff: chrome/browser/chromeos/settings/cros_settings.cc

Issue 148843002: Make an online wildcard login check for enterprise devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/cros_settings.cc
diff --git a/chrome/browser/chromeos/settings/cros_settings.cc b/chrome/browser/chromeos/settings/cros_settings.cc
index 382add78371c510aef1a7a561c79423bf4c2ef1d..61ab7000421a6ac6d4e2ee225e84616488ee70bc 100644
--- a/chrome/browser/chromeos/settings/cros_settings.cc
+++ b/chrome/browser/chromeos/settings/cros_settings.cc
@@ -200,7 +200,8 @@ bool CrosSettings::GetDictionary(
}
bool CrosSettings::FindEmailInList(const std::string& path,
- const std::string& email) const {
+ const std::string& email,
+ bool* wildcard_match) const {
DCHECK(CalledOnValidThread());
std::string canonicalized_email(
gaia::CanonicalizeEmail(gaia::SanitizeEmail(email)));
@@ -211,9 +212,14 @@ bool CrosSettings::FindEmailInList(const std::string& path,
std::string("*").append(canonicalized_email.substr(at_pos));
}
+ if (wildcard_match)
+ *wildcard_match = false;
+
const base::ListValue* list;
if (!GetList(path, &list))
return false;
+
+ bool found_wildcard_match = false;
for (base::ListValue::const_iterator entry(list->begin());
entry != list->end();
++entry) {
@@ -225,12 +231,19 @@ bool CrosSettings::FindEmailInList(const std::string& path,
std::string canonicalized_entry(
gaia::CanonicalizeEmail(gaia::SanitizeEmail(entry_string)));
- if (canonicalized_entry == canonicalized_email ||
- canonicalized_entry == wildcard_email) {
+ if (canonicalized_entry == canonicalized_email)
return true;
- }
+
+ // If there is a wildcard match, don't exit early. There might be an exact
+ // match further down the list that should take precedence if present.
+ if (canonicalized_entry == wildcard_email)
+ found_wildcard_match = true;
}
- return false;
+
+ if (wildcard_match)
+ *wildcard_match = found_wildcard_match;
+
+ return found_wildcard_match;
}
bool CrosSettings::AddSettingsProvider(CrosSettingsProvider* provider) {
« no previous file with comments | « chrome/browser/chromeos/settings/cros_settings.h ('k') | chrome/browser/chromeos/settings/cros_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698