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

Side by Side Diff: chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.cc

Issue 24261010: Allow explicitly whitelisted apps/extensions in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol icy_provider.h"
6
7 #include <string>
8
9 #include "base/logging.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/common/extensions/extension.h"
12 #include "extensions/common/manifest.h"
13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h"
15
16 namespace chromeos {
17
18 namespace {
19
20 // Apps/extensions explicitly whitelisted for use in device-local accounts.
21 const char* kDeviceLocalAccountWhitelist[] = {
22 "bpmcpldpdmajfigpchkicefoigmkfalc", // QuickOffice
23 };
24
25 } // namespace
26
27 DeviceLocalAccountManagementPolicyProvider::
28 DeviceLocalAccountManagementPolicyProvider() {
29 }
30
31 DeviceLocalAccountManagementPolicyProvider::
32 ~DeviceLocalAccountManagementPolicyProvider() {
33 }
34
35 std::string DeviceLocalAccountManagementPolicyProvider::
36 GetDebugPolicyProviderName() const {
37 #if defined(NDEBUG)
38 NOTREACHED();
39 return std::string();
40 #else
41 return "whitelist for device-local accounts";
42 #endif
43 }
44
45 bool DeviceLocalAccountManagementPolicyProvider::UserMayLoad(
46 const extensions::Extension* extension,
47 string16* error) const {
48 // Allow extension if its type is whitelisted for use in device-local
49 // accounts.
50 if (extension->GetType() == extensions::Manifest::TYPE_HOSTED_APP)
51 return true;
52
53 // Allow extension if its specific ID is whitelisted for use in device-local
54 // accounts.
55 for (size_t i = 0; i < arraysize(kDeviceLocalAccountWhitelist); ++i) {
56 if (extension->id() == kDeviceLocalAccountWhitelist[i])
57 return true;
58 }
59
60 // Disallow all other extensions.
61 if (error) {
62 *error = l10n_util::GetStringFUTF16(
63 IDS_EXTENSION_CANT_INSTALL_IN_PUBLIC_SESSION,
64 UTF8ToUTF16(extension->name()),
65 UTF8ToUTF16(extension->id()));
66 }
67 return false;
68 }
69
70 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698