| 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/string_tokenizer.h" | 14 #include "base/string_tokenizer.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/common/child_process_logging.h" | 17 #include "chrome/common/child_process_logging.h" |
| 18 #include "chrome/common/chrome_content_client.h" | 18 #include "chrome/common/chrome_content_client.h" |
| 19 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/content_settings_pattern.h" | 21 #include "chrome/common/content_settings_pattern.h" |
| 22 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 24 #include "chrome/common/extensions/extension_process_policy.h" | 25 #include "chrome/common/extensions/extension_process_policy.h" |
| 25 #include "chrome/common/extensions/extension_set.h" | 26 #include "chrome/common/extensions/extension_set.h" |
| 27 #include "chrome/common/extensions/manifest_handler.h" |
| 28 #include "chrome/common/extensions/manifest_url_handler.h" |
| 26 #include "chrome/common/external_ipc_fuzzer.h" | 29 #include "chrome/common/external_ipc_fuzzer.h" |
| 27 #include "chrome/common/jstemplate_builder.h" | 30 #include "chrome/common/jstemplate_builder.h" |
| 28 #include "chrome/common/localized_error.h" | 31 #include "chrome/common/localized_error.h" |
| 29 #include "chrome/common/render_messages.h" | 32 #include "chrome/common/render_messages.h" |
| 30 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 31 #include "chrome/renderer/autofill/autofill_agent.h" | 34 #include "chrome/renderer/autofill/autofill_agent.h" |
| 32 #include "chrome/renderer/autofill/password_autofill_manager.h" | 35 #include "chrome/renderer/autofill/password_autofill_manager.h" |
| 33 #include "chrome/renderer/autofill/password_generation_manager.h" | 36 #include "chrome/renderer/autofill/password_generation_manager.h" |
| 34 #include "chrome/renderer/automation/automation_renderer_helper.h" | 37 #include "chrome/renderer/automation/automation_renderer_helper.h" |
| 35 #include "chrome/renderer/benchmarking_extension.h" | 38 #include "chrome/renderer/benchmarking_extension.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 using WebKit::WebSecurityPolicy; | 113 using WebKit::WebSecurityPolicy; |
| 111 using WebKit::WebString; | 114 using WebKit::WebString; |
| 112 using WebKit::WebURL; | 115 using WebKit::WebURL; |
| 113 using WebKit::WebURLError; | 116 using WebKit::WebURLError; |
| 114 using WebKit::WebURLRequest; | 117 using WebKit::WebURLRequest; |
| 115 using WebKit::WebURLResponse; | 118 using WebKit::WebURLResponse; |
| 116 using WebKit::WebVector; | 119 using WebKit::WebVector; |
| 117 | 120 |
| 118 namespace { | 121 namespace { |
| 119 | 122 |
| 123 // Explicitly register all extension ManifestHandlers needed to parse |
| 124 // fields used in the renderer. |
| 125 void RegisterExtensionManifestHandlers() { |
| 126 extensions::ManifestHandler::Register( |
| 127 extension_manifest_keys::kDevToolsPage, |
| 128 new extensions::DevToolsPageHandler); |
| 129 } |
| 130 |
| 120 static void AppendParams(const std::vector<string16>& additional_names, | 131 static void AppendParams(const std::vector<string16>& additional_names, |
| 121 const std::vector<string16>& additional_values, | 132 const std::vector<string16>& additional_values, |
| 122 WebVector<WebString>* existing_names, | 133 WebVector<WebString>* existing_names, |
| 123 WebVector<WebString>* existing_values) { | 134 WebVector<WebString>* existing_values) { |
| 124 DCHECK(additional_names.size() == additional_values.size()); | 135 DCHECK(additional_names.size() == additional_values.size()); |
| 125 DCHECK(existing_names->size() == existing_values->size()); | 136 DCHECK(existing_names->size() == existing_values->size()); |
| 126 | 137 |
| 127 size_t existing_size = existing_names->size(); | 138 size_t existing_size = existing_names->size(); |
| 128 size_t total_size = existing_size + additional_names.size(); | 139 size_t total_size = existing_size + additional_names.size(); |
| 129 | 140 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // chrome-extension-resource: resources should be allowed to receive CORS | 262 // chrome-extension-resource: resources should be allowed to receive CORS |
| 252 // requests. | 263 // requests. |
| 253 WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_resource_scheme); | 264 WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_resource_scheme); |
| 254 | 265 |
| 255 // chrome-extension: resources should bypass Content Security Policy checks | 266 // chrome-extension: resources should bypass Content Security Policy checks |
| 256 // when included in protected resources. | 267 // when included in protected resources. |
| 257 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( | 268 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( |
| 258 extension_scheme); | 269 extension_scheme); |
| 259 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( | 270 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( |
| 260 extension_resource_scheme); | 271 extension_resource_scheme); |
| 272 |
| 273 RegisterExtensionManifestHandlers(); |
| 261 } | 274 } |
| 262 | 275 |
| 263 void ChromeContentRendererClient::RenderViewCreated( | 276 void ChromeContentRendererClient::RenderViewCreated( |
| 264 content::RenderView* render_view) { | 277 content::RenderView* render_view) { |
| 265 ContentSettingsObserver* content_settings = | 278 ContentSettingsObserver* content_settings = |
| 266 new ContentSettingsObserver(render_view); | 279 new ContentSettingsObserver(render_view); |
| 267 if (chrome_observer_.get()) { | 280 if (chrome_observer_.get()) { |
| 268 content_settings->SetContentSettingRules( | 281 content_settings->SetContentSettingRules( |
| 269 chrome_observer_->content_setting_rules()); | 282 chrome_observer_->content_setting_rules()); |
| 270 } | 283 } |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 } | 1035 } |
| 1023 | 1036 |
| 1024 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 1037 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
| 1025 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 1038 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
| 1026 #if defined(ENABLE_PLUGINS) | 1039 #if defined(ENABLE_PLUGINS) |
| 1027 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 1040 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
| 1028 #endif | 1041 #endif |
| 1029 } | 1042 } |
| 1030 | 1043 |
| 1031 } // namespace chrome | 1044 } // namespace chrome |
| OLD | NEW |