| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/common/child_process_logging.h" | 16 #include "chrome/common/child_process_logging.h" |
| 17 #include "chrome/common/chrome_content_client.h" | 17 #include "chrome/common/chrome_content_client.h" |
| 18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/content_settings_pattern.h" | 20 #include "chrome/common/content_settings_pattern.h" |
| 21 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" | 21 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" |
| 22 #include "chrome/common/extensions/background_info.h" |
| 22 #include "chrome/common/extensions/csp_handler.h" | 23 #include "chrome/common/extensions/csp_handler.h" |
| 23 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
| 25 #include "chrome/common/extensions/extension_manifest_constants.h" | 26 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 26 #include "chrome/common/extensions/extension_process_policy.h" | 27 #include "chrome/common/extensions/extension_process_policy.h" |
| 27 #include "chrome/common/extensions/extension_set.h" | 28 #include "chrome/common/extensions/extension_set.h" |
| 28 #include "chrome/common/extensions/manifest_handler.h" | 29 #include "chrome/common/extensions/manifest_handler.h" |
| 29 #include "chrome/common/extensions/manifest_url_handler.h" | 30 #include "chrome/common/extensions/manifest_url_handler.h" |
| 30 #include "chrome/common/extensions/web_accessible_resources_handler.h" | 31 #include "chrome/common/extensions/web_accessible_resources_handler.h" |
| 31 #include "chrome/common/external_ipc_fuzzer.h" | 32 #include "chrome/common/external_ipc_fuzzer.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 using WebKit::WebURLError; | 124 using WebKit::WebURLError; |
| 124 using WebKit::WebURLRequest; | 125 using WebKit::WebURLRequest; |
| 125 using WebKit::WebURLResponse; | 126 using WebKit::WebURLResponse; |
| 126 using WebKit::WebVector; | 127 using WebKit::WebVector; |
| 127 | 128 |
| 128 namespace { | 129 namespace { |
| 129 | 130 |
| 130 // Explicitly register all extension ManifestHandlers needed to parse | 131 // Explicitly register all extension ManifestHandlers needed to parse |
| 131 // fields used in the renderer. | 132 // fields used in the renderer. |
| 132 void RegisterExtensionManifestHandlers() { | 133 void RegisterExtensionManifestHandlers() { |
| 133 extensions::ManifestHandler::Register( | 134 (new extensions::BackgroundManifestHandler)->Register(); |
| 134 extension_manifest_keys::kDevToolsPage, | 135 (new extensions::DevToolsPageHandler)->Register(); |
| 135 make_linked_ptr(new extensions::DevToolsPageHandler)); | 136 (new extensions::WebAccessibleResourcesHandler)->Register(); |
| 136 extensions::ManifestHandler::Register( | 137 (new extensions::PageActionHandler)->Register(); |
| 137 extension_manifest_keys::kWebAccessibleResources, | 138 (new extensions::CSPHandler(false))->Register(); // not platform app. |
| 138 make_linked_ptr(new extensions::WebAccessibleResourcesHandler)); | 139 (new extensions::CSPHandler(true))->Register(); // platform app. |
| 139 linked_ptr<extensions::PageActionHandler> page_action_handler( | |
| 140 new extensions::PageActionHandler); | |
| 141 extensions::ManifestHandler::Register( | |
| 142 extension_manifest_keys::kPageAction, page_action_handler); | |
| 143 extensions::ManifestHandler::Register( | |
| 144 extension_manifest_keys::kPageActions, page_action_handler); | |
| 145 extensions::ManifestHandler::Register( | |
| 146 extension_manifest_keys::kContentSecurityPolicy, | |
| 147 make_linked_ptr(new extensions::CSPHandler(false))); // not platform app. | |
| 148 extensions::ManifestHandler::Register( | |
| 149 extension_manifest_keys::kPlatformAppContentSecurityPolicy, | |
| 150 make_linked_ptr(new extensions::CSPHandler(true))); // platform app. | |
| 151 } | 140 } |
| 152 | 141 |
| 153 static void AppendParams(const std::vector<string16>& additional_names, | 142 static void AppendParams(const std::vector<string16>& additional_names, |
| 154 const std::vector<string16>& additional_values, | 143 const std::vector<string16>& additional_values, |
| 155 WebVector<WebString>* existing_names, | 144 WebVector<WebString>* existing_names, |
| 156 WebVector<WebString>* existing_values) { | 145 WebVector<WebString>* existing_values) { |
| 157 DCHECK(additional_names.size() == additional_values.size()); | 146 DCHECK(additional_names.size() == additional_values.size()); |
| 158 DCHECK(existing_names->size() == existing_values->size()); | 147 DCHECK(existing_names->size() == existing_values->size()); |
| 159 | 148 |
| 160 size_t existing_size = existing_names->size(); | 149 size_t existing_size = existing_names->size(); |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 } | 1068 } |
| 1080 | 1069 |
| 1081 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 1070 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
| 1082 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 1071 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
| 1083 #if defined(ENABLE_PLUGINS) | 1072 #if defined(ENABLE_PLUGINS) |
| 1084 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 1073 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
| 1085 #endif | 1074 #endif |
| 1086 } | 1075 } |
| 1087 | 1076 |
| 1088 } // namespace chrome | 1077 } // namespace chrome |
| OLD | NEW |