| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/test/test_extensions_client.h" | 5 #include "extensions/test/test_extensions_client.h" |
| 6 | 6 |
| 7 #include "extensions/common/api/generated_schemas.h" | 7 #include "extensions/common/api/generated_schemas.h" |
| 8 #include "extensions/common/common_manifest_handlers.h" | 8 #include "extensions/common/common_manifest_handlers.h" |
| 9 #include "extensions/common/features/api_feature.h" | 9 #include "extensions/common/features/api_feature.h" |
| 10 #include "extensions/common/features/base_feature_provider.h" | 10 #include "extensions/common/features/base_feature_provider.h" |
| 11 #include "extensions/common/features/feature_provider.h" | 11 #include "extensions/common/features/feature_provider.h" |
| 12 #include "extensions/common/features/json_feature_provider_source.h" | 12 #include "extensions/common/features/json_feature_provider_source.h" |
| 13 #include "extensions/common/features/manifest_feature.h" | 13 #include "extensions/common/features/manifest_feature.h" |
| 14 #include "extensions/common/features/permission_feature.h" | 14 #include "extensions/common/features/permission_feature.h" |
| 15 #include "extensions/common/manifest_handler.h" | 15 #include "extensions/common/manifest_handler.h" |
| 16 #include "extensions/common/permissions/extensions_api_permissions.h" |
| 17 #include "extensions/common/permissions/permissions_info.h" |
| 16 #include "extensions/common/url_pattern_set.h" | 18 #include "extensions/common/url_pattern_set.h" |
| 17 #include "extensions/test/test_permission_message_provider.h" | 19 #include "extensions/test/test_permission_message_provider.h" |
| 18 #include "grit/extensions_resources.h" | 20 #include "grit/extensions_resources.h" |
| 19 | 21 |
| 20 namespace extensions { | 22 namespace extensions { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| 24 template <class FeatureClass> | 26 template <class FeatureClass> |
| 25 SimpleFeature* CreateFeature() { | 27 SimpleFeature* CreateFeature() { |
| 26 return new FeatureClass; | 28 return new FeatureClass; |
| 27 } | 29 } |
| 28 | 30 |
| 29 } // namespace | 31 } // namespace |
| 30 | 32 |
| 31 TestExtensionsClient::TestExtensionsClient() { | 33 TestExtensionsClient::TestExtensionsClient() { |
| 32 } | 34 } |
| 33 | 35 |
| 34 TestExtensionsClient::~TestExtensionsClient() { | 36 TestExtensionsClient::~TestExtensionsClient() { |
| 35 } | 37 } |
| 36 | 38 |
| 37 void TestExtensionsClient::Initialize() { | 39 void TestExtensionsClient::Initialize() { |
| 38 // Registration could already be finalized in unit tests, where the utility | 40 // Registration could already be finalized in unit tests, where the utility |
| 39 // thread runs in-process. | 41 // thread runs in-process. |
| 40 if (!ManifestHandler::IsRegistrationFinalized()) { | 42 if (!ManifestHandler::IsRegistrationFinalized()) { |
| 41 RegisterCommonManifestHandlers(); | 43 RegisterCommonManifestHandlers(); |
| 42 ManifestHandler::FinalizeRegistration(); | 44 ManifestHandler::FinalizeRegistration(); |
| 43 } | 45 } |
| 46 |
| 47 // Allow the core API permissions. |
| 48 static ExtensionsAPIPermissions extensions_api_permissions; |
| 49 PermissionsInfo::GetInstance()->AddProvider(extensions_api_permissions); |
| 44 } | 50 } |
| 45 | 51 |
| 46 const PermissionMessageProvider& | 52 const PermissionMessageProvider& |
| 47 TestExtensionsClient::GetPermissionMessageProvider() const { | 53 TestExtensionsClient::GetPermissionMessageProvider() const { |
| 48 static TestPermissionMessageProvider provider; | 54 static TestPermissionMessageProvider provider; |
| 49 return provider; | 55 return provider; |
| 50 } | 56 } |
| 51 | 57 |
| 52 scoped_ptr<FeatureProvider> TestExtensionsClient::CreateFeatureProvider( | 58 scoped_ptr<FeatureProvider> TestExtensionsClient::CreateFeatureProvider( |
| 53 const std::string& name) const { | 59 const std::string& name) const { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 132 } |
| 127 | 133 |
| 128 void TestExtensionsClient::RegisterAPISchemaResources(ExtensionAPI* api) const { | 134 void TestExtensionsClient::RegisterAPISchemaResources(ExtensionAPI* api) const { |
| 129 } | 135 } |
| 130 | 136 |
| 131 bool TestExtensionsClient::ShouldSuppressFatalErrors() const { | 137 bool TestExtensionsClient::ShouldSuppressFatalErrors() const { |
| 132 return true; | 138 return true; |
| 133 } | 139 } |
| 134 | 140 |
| 135 } // namespace extensions | 141 } // namespace extensions |
| OLD | NEW |