| 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/common/extensions/chrome_extensions_client.h" | 5 #include "chrome/common/extensions/chrome_extensions_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/extensions/api/api_features.h" | 15 #include "chrome/common/extensions/api/api_features.h" |
| 16 #include "chrome/common/extensions/api/behavior_features.h" | 16 #include "chrome/common/extensions/api/behavior_features.h" |
| 17 #include "chrome/common/extensions/api/extension_action/action_info.h" | 17 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 18 #include "chrome/common/extensions/api/generated_schemas.h" | 18 #include "chrome/common/extensions/api/generated_schemas.h" |
| 19 #include "chrome/common/extensions/api/manifest_features.h" | 19 #include "chrome/common/extensions/api/manifest_features.h" |
| 20 #include "chrome/common/extensions/api/permission_features.h" | 20 #include "chrome/common/extensions/api/permission_features.h" |
| 21 #include "chrome/common/extensions/chrome_aliases.h" |
| 21 #include "chrome/common/extensions/chrome_manifest_handlers.h" | 22 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
| 22 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
| 23 #include "chrome/common/extensions/manifest_handlers/theme_handler.h" | 24 #include "chrome/common/extensions/manifest_handlers/theme_handler.h" |
| 24 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 25 #include "chrome/grit/chromium_strings.h" | 26 #include "chrome/grit/chromium_strings.h" |
| 26 #include "chrome/grit/common_resources.h" | 27 #include "chrome/grit/common_resources.h" |
| 27 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
| 28 #include "components/version_info/version_info.h" | 29 #include "components/version_info/version_info.h" |
| 29 #include "content/public/common/url_constants.h" | 30 #include "content/public/common/url_constants.h" |
| 30 #include "extensions/common/api/generated_schemas.h" | 31 #include "extensions/common/api/generated_schemas.h" |
| 31 #include "extensions/common/common_manifest_handlers.h" | 32 #include "extensions/common/common_manifest_handlers.h" |
| 32 #include "extensions/common/constants.h" | 33 #include "extensions/common/constants.h" |
| 33 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
| 34 #include "extensions/common/extension_api.h" | 35 #include "extensions/common/extension_api.h" |
| 35 #include "extensions/common/extension_icon_set.h" | 36 #include "extensions/common/extension_icon_set.h" |
| 36 #include "extensions/common/extension_urls.h" | 37 #include "extensions/common/extension_urls.h" |
| 38 #include "extensions/common/extensions_aliases.h" |
| 37 #include "extensions/common/features/api_feature.h" | 39 #include "extensions/common/features/api_feature.h" |
| 38 #include "extensions/common/features/behavior_feature.h" | 40 #include "extensions/common/features/behavior_feature.h" |
| 39 #include "extensions/common/features/feature_channel.h" | 41 #include "extensions/common/features/feature_channel.h" |
| 40 #include "extensions/common/features/feature_provider.h" | 42 #include "extensions/common/features/feature_provider.h" |
| 41 #include "extensions/common/features/json_feature_provider_source.h" | 43 #include "extensions/common/features/json_feature_provider_source.h" |
| 42 #include "extensions/common/features/manifest_feature.h" | 44 #include "extensions/common/features/manifest_feature.h" |
| 43 #include "extensions/common/features/permission_feature.h" | 45 #include "extensions/common/features/permission_feature.h" |
| 44 #include "extensions/common/features/simple_feature.h" | 46 #include "extensions/common/features/simple_feature.h" |
| 45 #include "extensions/common/manifest_constants.h" | 47 #include "extensions/common/manifest_constants.h" |
| 46 #include "extensions/common/manifest_handler.h" | 48 #include "extensions/common/manifest_handler.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 void ChromeExtensionsClient::Initialize() { | 113 void ChromeExtensionsClient::Initialize() { |
| 112 // Registration could already be finalized in unit tests, where the utility | 114 // Registration could already be finalized in unit tests, where the utility |
| 113 // thread runs in-process. | 115 // thread runs in-process. |
| 114 if (!ManifestHandler::IsRegistrationFinalized()) { | 116 if (!ManifestHandler::IsRegistrationFinalized()) { |
| 115 RegisterCommonManifestHandlers(); | 117 RegisterCommonManifestHandlers(); |
| 116 RegisterChromeManifestHandlers(); | 118 RegisterChromeManifestHandlers(); |
| 117 ManifestHandler::FinalizeRegistration(); | 119 ManifestHandler::FinalizeRegistration(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 // Set up permissions. | 122 // Set up permissions. |
| 121 PermissionsInfo::GetInstance()->AddProvider(chrome_api_permissions_); | 123 PermissionsInfo::GetInstance()->AddProvider(chrome_api_permissions_, |
| 122 PermissionsInfo::GetInstance()->AddProvider(extensions_api_permissions_); | 124 GetChromePermissionAliases()); |
| 125 PermissionsInfo::GetInstance()->AddProvider(extensions_api_permissions_, |
| 126 GetExtensionsPermissionAliases()); |
| 123 | 127 |
| 124 // Set up the scripting whitelist. | 128 // Set up the scripting whitelist. |
| 125 // Whitelist ChromeVox, an accessibility extension from Google that needs | 129 // Whitelist ChromeVox, an accessibility extension from Google that needs |
| 126 // the ability to script webui pages. This is temporary and is not | 130 // the ability to script webui pages. This is temporary and is not |
| 127 // meant to be a general solution. | 131 // meant to be a general solution. |
| 128 // TODO(dmazzoni): remove this once we have an extension API that | 132 // TODO(dmazzoni): remove this once we have an extension API that |
| 129 // allows any extension to request read-only access to webui pages. | 133 // allows any extension to request read-only access to webui pages. |
| 130 scripting_whitelist_.push_back(extension_misc::kChromeVoxExtensionId); | 134 scripting_whitelist_.push_back(extension_misc::kChromeVoxExtensionId); |
| 131 } | 135 } |
| 132 | 136 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 const { | 334 const { |
| 331 return GetCurrentChannel() == version_info::Channel::UNKNOWN; | 335 return GetCurrentChannel() == version_info::Channel::UNKNOWN; |
| 332 } | 336 } |
| 333 | 337 |
| 334 // static | 338 // static |
| 335 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { | 339 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { |
| 336 return g_client.Pointer(); | 340 return g_client.Pointer(); |
| 337 } | 341 } |
| 338 | 342 |
| 339 } // namespace extensions | 343 } // namespace extensions |
| OLD | NEW |