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

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

Issue 2858643002: PS - Filtering activeTab URL (Closed)
Patch Set: ExtensionBuilder in test Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 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 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/extensions/device_local_account_management_pol icy_provider.h" 5 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol icy_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <string> 10 #include <string>
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 policy::DeviceLocalAccount::Type account_type) 883 policy::DeviceLocalAccount::Type account_type)
884 : account_type_(account_type) { 884 : account_type_(account_type) {
885 } 885 }
886 886
887 DeviceLocalAccountManagementPolicyProvider:: 887 DeviceLocalAccountManagementPolicyProvider::
888 ~DeviceLocalAccountManagementPolicyProvider() { 888 ~DeviceLocalAccountManagementPolicyProvider() {
889 } 889 }
890 890
891 // static 891 // static
892 bool DeviceLocalAccountManagementPolicyProvider::IsWhitelisted( 892 bool DeviceLocalAccountManagementPolicyProvider::IsWhitelisted(
893 const extensions::Extension* extension) { 893 const std::string& extension_id) {
894 return ArrayContains(kPublicSessionWhitelist, extension->id()); 894 return ArrayContains(kPublicSessionWhitelist, extension_id);
895 } 895 }
896 896
897 std::string DeviceLocalAccountManagementPolicyProvider:: 897 std::string DeviceLocalAccountManagementPolicyProvider::
898 GetDebugPolicyProviderName() const { 898 GetDebugPolicyProviderName() const {
899 #if defined(NDEBUG) 899 #if defined(NDEBUG)
900 NOTREACHED(); 900 NOTREACHED();
901 return std::string(); 901 return std::string();
902 #else 902 #else
903 return "whitelist for device-local accounts"; 903 return "whitelist for device-local accounts";
904 #endif 904 #endif
905 } 905 }
906 906
907 bool DeviceLocalAccountManagementPolicyProvider::UserMayLoad( 907 bool DeviceLocalAccountManagementPolicyProvider::UserMayLoad(
908 const extensions::Extension* extension, 908 const extensions::Extension* extension,
909 base::string16* error) const { 909 base::string16* error) const {
910 if (account_type_ == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) { 910 if (account_type_ == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) {
911 // Allow extension if it is an externally hosted component of Chrome. 911 // Allow extension if it is an externally hosted component of Chrome.
912 if (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT) { 912 if (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT) {
913 return true; 913 return true;
914 } 914 }
915 915
916 // TODO(isandrk): Remove when whitelisting work is done (crbug/651027). 916 // TODO(isandrk): Remove when whitelisting work is done (crbug/651027).
917 // Allow extension if its type is whitelisted for use in public sessions. 917 // Allow extension if its type is whitelisted for use in public sessions.
918 if (extension->GetType() == extensions::Manifest::TYPE_HOSTED_APP) { 918 if (extension->GetType() == extensions::Manifest::TYPE_HOSTED_APP) {
919 return true; 919 return true;
920 } 920 }
921 921
922 // Allow extension if its specific ID is whitelisted for use in public 922 // Allow extension if its specific ID is whitelisted for use in public
923 // sessions. 923 // sessions.
924 if (IsWhitelisted(extension)) { 924 if (IsWhitelisted(extension->id())) {
925 return true; 925 return true;
926 } 926 }
927 927
928 // Allow force-installed extension if all manifest contents are whitelisted. 928 // Allow force-installed extension if all manifest contents are whitelisted.
929 if ((extension->location() == extensions::Manifest::EXTERNAL_POLICY_DOWNLOAD 929 if ((extension->location() == extensions::Manifest::EXTERNAL_POLICY_DOWNLOAD
930 || extension->location() == extensions::Manifest::EXTERNAL_POLICY) 930 || extension->location() == extensions::Manifest::EXTERNAL_POLICY)
931 && IsSafeForPublicSession(extension)) { 931 && IsSafeForPublicSession(extension)) {
932 return true; 932 return true;
933 } 933 }
934 } else if (account_type_ == policy::DeviceLocalAccount::TYPE_KIOSK_APP) { 934 } else if (account_type_ == policy::DeviceLocalAccount::TYPE_KIOSK_APP) {
(...skipping 10 matching lines...) Expand all
945 if (error) { 945 if (error) {
946 *error = l10n_util::GetStringFUTF16( 946 *error = l10n_util::GetStringFUTF16(
947 IDS_EXTENSION_CANT_INSTALL_IN_DEVICE_LOCAL_ACCOUNT, 947 IDS_EXTENSION_CANT_INSTALL_IN_DEVICE_LOCAL_ACCOUNT,
948 base::UTF8ToUTF16(extension->name()), 948 base::UTF8ToUTF16(extension->name()),
949 base::UTF8ToUTF16(extension->id())); 949 base::UTF8ToUTF16(extension->id()));
950 } 950 }
951 return false; 951 return false;
952 } 952 }
953 953
954 } // namespace chromeos 954 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698