This source file includes following definitions.
- DeviceLocalAccountManagementPolicyProvider
- DeviceLocalAccountManagementPolicyProvider
- GetDebugPolicyProviderName
- UserMayLoad
#include "chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.h"
#include <string>
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
namespace chromeos {
namespace {
const char* kPublicSessionWhitelist[] = {
"cbkkbcmdlboombapidmoeolnmdacpkch",
"djflhoibgkdhkhhcedjiklpkjnoahfmg",
"iabmpiboiopbgfabjmgeedhcmjenhbla",
"ehcabepphndocfmgbdkbjibfodelmpbb",
"kgimkbnclbekdkabkpjhpakhhalfanda",
"joodangkbfjnajiiifokapkpmhfnpleo",
"fpgfohogebplgnamlafljlcidjedbdeb",
"hfhhnacclhffhdffklopdkcgdhifgngh",
"cdjikkcakjcdjemakobkmijmikhkegcj",
"jkoildpomkimndcphjpffmephmcmkfhn",
"ielkookhdphmgbipcfmafkaiagademfp",
"kogjlbfgggambihdjcpijgcbmenblimd",
"ogbkmlkceflgpilgbmbcfbifckpkfacf",
"pbbbjjecobhljkkcenlakfnkmkfkfamd",
"jkbfjmnjcdmhlfpephomoiipbhcoiffb",
"dgmblbpgafgcgpkoiilhjifindhinmai",
"iggnealjakkgfofealilhkkclnbnfnmo",
"lplkobnahgbopmpkdapaihnnojkphahc",
"lejnflfhjpcannpaghnahbedlabpmhoh",
"ebkhfdfghngbimnpgelagnfacdafhaba",
"npnjdccdffhdndcbeappiamcehbhjibf",
"iddohohhpmajlkbejjjcfednjnhlnenk",
"bjdhhokmhgelphffoafoejjmlfblpdha",
"mdhnphfgagkpdhndljccoackjjhghlif",
"dondgdlndnpianbklfnehgdhkickdjck",
"fgjnkhlabjcaajddbaenilcmpcidahll",
"ifpkhncdnjfipfjlhfidljjffdgklanh",
"cgmlfbhkckbedohgdepgbkflommbfkep",
"edhhaiphkklkcfcbnlbpbiepchnkgkpn",
"diehajhcjifpahdplfdkhiboknagmfii",
"nhpmmldpbfjofkipjaieeomhnmcgihfm",
"onbhgdmifjebcabplolilidlpgeknifi",
"kkkbcoabfhgekpnddfkaphobhinociem",
"adlphlfdhhjenpgimjochcpelbijkich",
"cgefhjmlaifaamhhoojmpcnihlbddeki",
"kpjjigggmcjinapdeipapdcnmnjealll",
"aleodiobpjillgfjdkblghiiaegggmcm",
"nifkmgcdokhkjghdlgflonppnefddien",
"hdmobeajeoanbanmdlabnbnlopepchip",
"dgohlccohkojjgkkfholmobjjoledflp",
"dhmdaeekeihmajjnmichlhiffffdbpde",
"jeabmjjifhfcejonjjhccaeigpnnjaak",
"pbdihpaifchmclcmkfdgffnnpfbobefh",
};
}
DeviceLocalAccountManagementPolicyProvider::
DeviceLocalAccountManagementPolicyProvider(
policy::DeviceLocalAccount::Type account_type)
: account_type_(account_type) {
}
DeviceLocalAccountManagementPolicyProvider::
~DeviceLocalAccountManagementPolicyProvider() {
}
std::string DeviceLocalAccountManagementPolicyProvider::
GetDebugPolicyProviderName() const {
#if defined(NDEBUG)
NOTREACHED();
return std::string();
#else
return "whitelist for device-local accounts";
#endif
}
bool DeviceLocalAccountManagementPolicyProvider::UserMayLoad(
const extensions::Extension* extension,
base::string16* error) const {
if (account_type_ == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) {
if (extension->location() ==
extensions::Manifest::EXTERNAL_COMPONENT) {
return true;
}
if (extension->GetType() == extensions::Manifest::TYPE_HOSTED_APP)
return true;
for (size_t i = 0; i < arraysize(kPublicSessionWhitelist); ++i) {
if (extension->id() == kPublicSessionWhitelist[i])
return true;
}
} else if (account_type_ == policy::DeviceLocalAccount::TYPE_KIOSK_APP) {
if (extension->GetType() == extensions::Manifest::TYPE_PLATFORM_APP)
return true;
}
if (error) {
*error = l10n_util::GetStringFUTF16(
IDS_EXTENSION_CANT_INSTALL_IN_DEVICE_LOCAL_ACCOUNT,
base::UTF8ToUTF16(extension->name()),
base::UTF8ToUTF16(extension->id()));
}
return false;
}
}