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

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account.cc

Issue 1233043003: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "chrome/browser/chromeos/policy/device_local_account.h" 5 #include "chrome/browser/chromeos/policy/device_local_account.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 domain_prefix + kDeviceLocalAccountDomainSuffix); 61 domain_prefix + kDeviceLocalAccountDomainSuffix);
62 } 62 }
63 63
64 bool IsDeviceLocalAccountUser(const std::string& user_id, 64 bool IsDeviceLocalAccountUser(const std::string& user_id,
65 DeviceLocalAccount::Type* type) { 65 DeviceLocalAccount::Type* type) {
66 // For historical reasons, the guest user ID does not contain an @ symbol and 66 // For historical reasons, the guest user ID does not contain an @ symbol and
67 // therefore, cannot be parsed by gaia::ExtractDomainName(). 67 // therefore, cannot be parsed by gaia::ExtractDomainName().
68 if (user_id == chromeos::login::kGuestUserName) 68 if (user_id == chromeos::login::kGuestUserName)
69 return false; 69 return false;
70 const std::string domain = gaia::ExtractDomainName(user_id); 70 const std::string domain = gaia::ExtractDomainName(user_id);
71 if (!base::EndsWith(domain, kDeviceLocalAccountDomainSuffix, true)) 71 if (!base::EndsWith(domain, kDeviceLocalAccountDomainSuffix,
72 base::CompareCase::SENSITIVE))
72 return false; 73 return false;
73 74
74 const std::string domain_prefix = domain.substr( 75 const std::string domain_prefix = domain.substr(
75 0, domain.size() - arraysize(kDeviceLocalAccountDomainSuffix) + 1); 76 0, domain.size() - arraysize(kDeviceLocalAccountDomainSuffix) + 1);
76 77
77 if (domain_prefix == kPublicAccountDomainPrefix) { 78 if (domain_prefix == kPublicAccountDomainPrefix) {
78 if (type) 79 if (type)
79 *type = DeviceLocalAccount::TYPE_PUBLIC_SESSION; 80 *type = DeviceLocalAccount::TYPE_PUBLIC_SESSION;
80 return true; 81 return true;
81 } 82 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 accounts.push_back( 181 accounts.push_back(
181 DeviceLocalAccount(static_cast<DeviceLocalAccount::Type>(type), 182 DeviceLocalAccount(static_cast<DeviceLocalAccount::Type>(type),
182 account_id, 183 account_id,
183 kiosk_app_id, 184 kiosk_app_id,
184 kiosk_app_update_url)); 185 kiosk_app_update_url));
185 } 186 }
186 return accounts; 187 return accounts;
187 } 188 }
188 189
189 } // namespace policy 190 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698