OLD | NEW |
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/policy/configuration_policy_handler_list_factory.h" | 5 #include "chrome/browser/policy/configuration_policy_handler_list_factory.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "components/user_manager/user.h" | 43 #include "components/user_manager/user.h" |
44 #include "components/user_manager/user_manager.h" | 44 #include "components/user_manager/user_manager.h" |
45 #endif | 45 #endif |
46 | 46 |
47 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 47 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
48 #include "chrome/browser/download/download_dir_policy_handler.h" | 48 #include "chrome/browser/download/download_dir_policy_handler.h" |
49 #endif | 49 #endif |
50 | 50 |
51 #if defined(ENABLE_EXTENSIONS) | 51 #if defined(ENABLE_EXTENSIONS) |
52 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handle
r.h" | 52 #include "chrome/browser/extensions/api/messaging/native_messaging_policy_handle
r.h" |
| 53 #include "chrome/browser/extensions/extension_management_constants.h" |
53 #include "chrome/browser/extensions/policy_handlers.h" | 54 #include "chrome/browser/extensions/policy_handlers.h" |
54 #include "extensions/browser/pref_names.h" | 55 #include "extensions/browser/pref_names.h" |
55 #include "extensions/common/manifest.h" | 56 #include "extensions/common/manifest.h" |
56 #endif | 57 #endif |
57 | 58 |
58 namespace policy { | 59 namespace policy { |
59 | 60 |
60 namespace { | 61 namespace { |
61 | 62 |
62 // List of policy types to preference names. This is used for simple policies | 63 // List of policy types to preference names. This is used for simple policies |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 { key::kBrowserAddPersonEnabled, | 487 { key::kBrowserAddPersonEnabled, |
487 prefs::kBrowserAddPersonEnabled, | 488 prefs::kBrowserAddPersonEnabled, |
488 base::Value::TYPE_BOOLEAN }, | 489 base::Value::TYPE_BOOLEAN }, |
489 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 490 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
490 }; | 491 }; |
491 | 492 |
492 #if defined(ENABLE_EXTENSIONS) | 493 #if defined(ENABLE_EXTENSIONS) |
493 void GetExtensionAllowedTypesMap( | 494 void GetExtensionAllowedTypesMap( |
494 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { | 495 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { |
495 // Mapping from extension type names to Manifest::Type. | 496 // Mapping from extension type names to Manifest::Type. |
496 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 497 for (size_t index = 0; |
497 "extension", scoped_ptr<base::Value>(new base::FundamentalValue( | 498 index < extensions::schema_constants::kAllowedTypesMapSize; |
498 extensions::Manifest::TYPE_EXTENSION)))); | 499 ++index) { |
499 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 500 const extensions::schema_constants::AllowedTypesMapEntry& entry = |
500 "theme", scoped_ptr<base::Value>(new base::FundamentalValue( | 501 extensions::schema_constants::kAllowedTypesMap[index]; |
501 extensions::Manifest::TYPE_THEME)))); | 502 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
502 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 503 entry.name, |
503 "user_script", scoped_ptr<base::Value>(new base::FundamentalValue( | 504 scoped_ptr<base::Value>( |
504 extensions::Manifest::TYPE_USER_SCRIPT)))); | 505 new base::FundamentalValue(entry.manifest_type)))); |
505 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 506 } |
506 "hosted_app", scoped_ptr<base::Value>(new base::FundamentalValue( | |
507 extensions::Manifest::TYPE_HOSTED_APP)))); | |
508 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | |
509 "legacy_packaged_app", scoped_ptr<base::Value>(new base::FundamentalValue( | |
510 extensions::Manifest::TYPE_LEGACY_PACKAGED_APP)))); | |
511 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | |
512 "platform_app", scoped_ptr<base::Value>(new base::FundamentalValue( | |
513 extensions::Manifest::TYPE_PLATFORM_APP)))); | |
514 } | 507 } |
515 #endif | 508 #endif |
516 | 509 |
517 #if !defined(OS_IOS) | 510 #if !defined(OS_IOS) |
518 void GetDeprecatedFeaturesMap( | 511 void GetDeprecatedFeaturesMap( |
519 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { | 512 ScopedVector<StringMappingListPolicyHandler::MappingEntry>* result) { |
520 // Maps feature tags as specified in policy to the corresponding switch to | 513 // Maps feature tags as specified in policy to the corresponding switch to |
521 // re-enable them. | 514 // re-enable them. |
522 // TODO: Remove after 2015-04-30 per http://crbug.com/374782. | 515 // TODO: Remove after 2015-04-30 per http://crbug.com/374782. |
523 result->push_back(new StringMappingListPolicyHandler::MappingEntry( | 516 result->push_back(new StringMappingListPolicyHandler::MappingEntry( |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 chrome_schema, | 785 chrome_schema, |
793 SCHEMA_STRICT, | 786 SCHEMA_STRICT, |
794 SimpleSchemaValidatingPolicyHandler::RECOMMENDED_ALLOWED, | 787 SimpleSchemaValidatingPolicyHandler::RECOMMENDED_ALLOWED, |
795 SimpleSchemaValidatingPolicyHandler::MANDATORY_PROHIBITED))); | 788 SimpleSchemaValidatingPolicyHandler::MANDATORY_PROHIBITED))); |
796 #endif // defined(OS_CHROMEOS) | 789 #endif // defined(OS_CHROMEOS) |
797 | 790 |
798 return handlers.Pass(); | 791 return handlers.Pass(); |
799 } | 792 } |
800 | 793 |
801 } // namespace policy | 794 } // namespace policy |
OLD | NEW |