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

Unified Diff: chrome/browser/chromeos/policy/device_local_account.cc

Issue 24261010: Allow explicitly whitelisted apps/extensions in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: constness fix. Created 7 years, 2 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/policy/device_local_account.cc
diff --git a/chrome/browser/chromeos/policy/device_local_account.cc b/chrome/browser/chromeos/policy/device_local_account.cc
index 2ad53ead08d131f0510cff9c9f137c649213851f..547dab238b2e33d67d4fc87d37dedd51f7baa103 100644
--- a/chrome/browser/chromeos/policy/device_local_account.cc
+++ b/chrome/browser/chromeos/policy/device_local_account.cc
@@ -6,6 +6,7 @@
#include <set>
+#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
@@ -56,16 +57,29 @@ std::string GenerateDeviceLocalAccountUserId(const std::string& account_id,
domain_prefix + kDeviceLocalAccountDomainSuffix);
}
-bool IsDeviceLocalAccountUser(const std::string& user_id) {
- return EndsWith(gaia::ExtractDomainName(user_id),
- kDeviceLocalAccountDomainSuffix,
- true);
-}
+bool IsDeviceLocalAccountUser(const std::string& user_id,
+ DeviceLocalAccount::Type* type) {
+ const std::string domain = gaia::ExtractDomainName(user_id);
+ if (!EndsWith(domain, kDeviceLocalAccountDomainSuffix, true))
+ return false;
+
+ const std::string domain_prefix = domain.substr(
+ 0, domain.size() - arraysize(kDeviceLocalAccountDomainSuffix) + 1);
+
+ if (domain_prefix == kPublicAccountDomainPrefix) {
+ if (type)
+ *type = DeviceLocalAccount::TYPE_PUBLIC_SESSION;
+ return true;
+ }
+ if (domain_prefix == kKioskAppAccountDomainPrefix) {
+ if (type)
+ *type = DeviceLocalAccount::TYPE_KIOSK_APP;
+ return true;
+ }
-bool IsKioskAppUser(const std::string& user_id) {
- return gaia::ExtractDomainName(user_id) ==
- std::string(kKioskAppAccountDomainPrefix) +
- kDeviceLocalAccountDomainSuffix;
+ // |user_id| is a device-local account but its type is not recognized.
+ NOTREACHED();
pastarmovj 2013/10/02 14:44:50 I think it will be still good to set |type| to som
bartfab (slow) 2013/10/02 14:48:35 Done.
+ return true;
}
void SetDeviceLocalAccounts(

Powered by Google App Engine
This is Rietveld 408576698