1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.h"
9 #include "base/logging.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/grit/generated_resources.h"
12 #include "extensions/common/extension.h"
13 #include "extensions/common/manifest.h"
14 #include "ui/base/l10n/l10n_util.h"
20 // Apps/extensions explicitly whitelisted for use in public sessions.
21 const char* const kPublicSessionWhitelist
[] = {
22 // Public sessions in general:
23 "cbkkbcmdlboombapidmoeolnmdacpkch", // Chrome RDP
24 "djflhoibgkdhkhhcedjiklpkjnoahfmg", // User Agent Switcher
25 "iabmpiboiopbgfabjmgeedhcmjenhbla", // VNC Viewer
26 "haiffjcadagjlijoggckpgfnoeiflnem", // Citrix Receiver
27 "mfaihdlpglflfgpfjcifdjdjcckigekc", // ARC Runtime
30 "aclofikceldphonlfmghmimkodjdmhck", // Ancoris login component
31 "eilbnahdgoddoedakcmfkcgfoegeloil", // Ancoris proxy component
32 "ceehlgckkmkaoggdnjhibffkphfnphmg", // Libdata login
33 "fnhgfoccpcjdnjcobejogdnlnidceemb", // OverDrive
36 "bjfeaefhaooblkndnoabbkkkenknkemb", // 500 px demo
37 "ehcabepphndocfmgbdkbjibfodelmpbb", // Angry Birds demo
38 "kgimkbnclbekdkabkpjhpakhhalfanda", // Bejeweled demo
39 "joodangkbfjnajiiifokapkpmhfnpleo", // Calculator
40 "fpgfohogebplgnamlafljlcidjedbdeb", // Calendar demo
41 "hfhhnacclhffhdffklopdkcgdhifgngh", // Camera
42 "cdjikkcakjcdjemakobkmijmikhkegcj", // Chrome Remote Desktop demo
43 "jkoildpomkimndcphjpffmephmcmkfhn", // Chromebook Demo App
44 "lbhdhapagjhalobandnbdnmblnmocojh", // Crackle demo
45 "ielkookhdphmgbipcfmafkaiagademfp", // Custom bookmarks
46 "kogjlbfgggambihdjcpijgcbmenblimd", // Custom bookmarks
47 "ogbkmlkceflgpilgbmbcfbifckpkfacf", // Custom bookmarks
48 "pbbbjjecobhljkkcenlakfnkmkfkfamd", // Custom bookmarks
49 "jkbfjmnjcdmhlfpephomoiipbhcoiffb", // Custom bookmarks
50 "dgmblbpgafgcgpkoiilhjifindhinmai", // Custom bookmarks
51 "iggnealjakkgfofealilhkkclnbnfnmo", // Custom bookmarks
52 "lplkobnahgbopmpkdapaihnnojkphahc", // Custom bookmarks
53 "lejnflfhjpcannpaghnahbedlabpmhoh", // Custom bookmarks
54 "dhjmfhojkfjmfbnbnpichdmcdghdpccg", // Cut the Rope demo
55 "ebkhfdfghngbimnpgelagnfacdafhaba", // Deezer demo
56 "npnjdccdffhdndcbeappiamcehbhjibf", // Docs.app demo
57 "ekgadegabdkcbkodfbgidncffijbghhl", // Duolingo demo
58 "iddohohhpmajlkbejjjcfednjnhlnenk", // Evernote demo
59 "bjdhhokmhgelphffoafoejjmlfblpdha", // Gmail demo
60 "nldmakcnfaflagmohifhcihkfgcbmhph", // Gmail offline demo
61 "mdhnphfgagkpdhndljccoackjjhghlif", // Google Drive demo
62 "dondgdlndnpianbklfnehgdhkickdjck", // Google Keep demo
63 "amfoiggnkefambnaaphodjdmdooiinna", // Google Play Movie and TV demo
64 "fgjnkhlabjcaajddbaenilcmpcidahll", // Google+ demo
65 "ifpkhncdnjfipfjlhfidljjffdgklanh", // Google+ Photos demo
66 "cgmlfbhkckbedohgdepgbkflommbfkep", // Hangouts.app demo
67 "ndlgnmfmgpdecjgehbcejboifbbmlkhp", // Hash demo
68 "edhhaiphkklkcfcbnlbpbiepchnkgkpn", // Helper.extension demo
69 "jckncghadoodfbbbmbpldacojkooophh", // Journal demo
70 "diehajhcjifpahdplfdkhiboknagmfii", // Kindle demo
71 "idneggepppginmaklfbaniklagjghpio", // Kingsroad demo
72 "nhpmmldpbfjofkipjaieeomhnmcgihfm", // Menu.app demo
73 "kcjbmmhccecjokfmckhddpmghepcnidb", // Mint demo
74 "onbhgdmifjebcabplolilidlpgeknifi", // Music.app demo
75 "kkkbcoabfhgekpnddfkaphobhinociem", // Netflix demo
76 "adlphlfdhhjenpgimjochcpelbijkich", // New York Times demo
77 "cgefhjmlaifaamhhoojmpcnihlbddeki", // Pandora demo
78 "kpjjigggmcjinapdeipapdcnmnjealll", // Pixlr demo
79 "ifnadhpngkodeccijnalokiabanejfgm", // Pixsta demo
80 "klcojgagjmpgmffcildkgbfmfffncpcd", // Plex demo
81 "nnikmgjhdlphciaonjmoppfckbpoinnb", // Pocket demo
82 "khldngaiohpnnoikfmnmfnebecgeobep", // Polarr Photo demo
83 "aleodiobpjillgfjdkblghiiaegggmcm", // Quickoffice demo
84 "nifkmgcdokhkjghdlgflonppnefddien", // Sheets demo
85 "hdmobeajeoanbanmdlabnbnlopepchip", // Slides demo
86 "ikmidginfdcbojdbmejkeakncgdbmonc", // Soundtrap demo
87 "dgohlccohkojjgkkfholmobjjoledflp", // Spotify demo
88 "dhmdaeekeihmajjnmichlhiffffdbpde", // Store.app demo
89 "onklhlmbpfnmgmelakhgehkfdmkpmekd", // Todoist demo
90 "jeabmjjifhfcejonjjhccaeigpnnjaak", // TweetDeck demo
91 "gnckahkflocidcgjbeheneogeflpjien", // Vine demo
92 "pdckcbpciaaicoomipamcabpdadhofgh", // Weatherbug demo
93 "biliocemfcghhioihldfdmkkhnofcgmb", // Webcam Toy demo
94 "bhfoghflalnnjfcfkaelngenjgjjhapk", // Wevideo demo
95 "pjckdjlmdcofkkkocnmhcbehkiapalho", // Wunderlist demo
96 "pbdihpaifchmclcmkfdgffnnpfbobefh", // YouTube demo
98 // Testing extensions:
99 "ongnjlefhnoajpbodoldndkbkdgfomlp", // Show Managed Storage
104 DeviceLocalAccountManagementPolicyProvider::
105 DeviceLocalAccountManagementPolicyProvider(
106 policy::DeviceLocalAccount::Type account_type
)
107 : account_type_(account_type
) {
110 DeviceLocalAccountManagementPolicyProvider::
111 ~DeviceLocalAccountManagementPolicyProvider() {
114 std::string
DeviceLocalAccountManagementPolicyProvider::
115 GetDebugPolicyProviderName() const {
118 return std::string();
120 return "whitelist for device-local accounts";
124 bool DeviceLocalAccountManagementPolicyProvider::UserMayLoad(
125 const extensions::Extension
* extension
,
126 base::string16
* error
) const {
127 if (account_type_
== policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION
) {
128 // Allow extension if it is an externally hosted component of Chrome.
129 if (extension
->location() ==
130 extensions::Manifest::EXTERNAL_COMPONENT
) {
134 // Allow extension if its type is whitelisted for use in public sessions.
135 if (extension
->GetType() == extensions::Manifest::TYPE_HOSTED_APP
)
138 // Allow extension if its specific ID is whitelisted for use in public
140 for (size_t i
= 0; i
< arraysize(kPublicSessionWhitelist
); ++i
) {
141 if (extension
->id() == kPublicSessionWhitelist
[i
])
144 } else if (account_type_
== policy::DeviceLocalAccount::TYPE_KIOSK_APP
) {
145 // For single-app kiosk sessions, allow platform apps and shared modules.
146 if (extension
->GetType() == extensions::Manifest::TYPE_PLATFORM_APP
||
147 extension
->GetType() == extensions::Manifest::TYPE_SHARED_MODULE
)
151 // Disallow all other extensions.
153 *error
= l10n_util::GetStringFUTF16(
154 IDS_EXTENSION_CANT_INSTALL_IN_DEVICE_LOCAL_ACCOUNT
,
155 base::UTF8ToUTF16(extension
->name()),
156 base::UTF8ToUTF16(extension
->id()));
161 } // namespace chromeos