Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 14694010: Consolidate manifest handler registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/unpacker_unittest.cc ('k') | chrome/test/base/chrome_test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_util.h" 13 #include "base/string_util.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/chrome_manifest_handlers.h"
22 #include "chrome/common/extensions/background_info.h"
23 #include "chrome/common/extensions/csp_handler.h"
24 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
25 #include "chrome/common/extensions/extension_constants.h" 23 #include "chrome/common/extensions/extension_constants.h"
26 #include "chrome/common/extensions/extension_manifest_constants.h" 24 #include "chrome/common/extensions/extension_manifest_constants.h"
27 #include "chrome/common/extensions/extension_process_policy.h" 25 #include "chrome/common/extensions/extension_process_policy.h"
28 #include "chrome/common/extensions/extension_set.h" 26 #include "chrome/common/extensions/extension_set.h"
29 #include "chrome/common/extensions/incognito_handler.h"
30 #include "chrome/common/extensions/manifest_handler.h"
31 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
32 #include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h"
33 #include "chrome/common/extensions/manifest_url_handler.h"
34 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" 27 #include "chrome/common/extensions/permissions/chrome_api_permissions.h"
35 #include "chrome/common/extensions/web_accessible_resources_handler.h"
36 #include "chrome/common/external_ipc_fuzzer.h" 28 #include "chrome/common/external_ipc_fuzzer.h"
37 #include "chrome/common/localized_error.h" 29 #include "chrome/common/localized_error.h"
38 #include "chrome/common/render_messages.h" 30 #include "chrome/common/render_messages.h"
39 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
40 #include "chrome/renderer/benchmarking_extension.h" 32 #include "chrome/renderer/benchmarking_extension.h"
41 #include "chrome/renderer/chrome_render_process_observer.h" 33 #include "chrome/renderer/chrome_render_process_observer.h"
42 #include "chrome/renderer/chrome_render_view_observer.h" 34 #include "chrome/renderer/chrome_render_view_observer.h"
43 #include "chrome/renderer/content_settings_observer.h" 35 #include "chrome/renderer/content_settings_observer.h"
44 #include "chrome/renderer/extensions/chrome_v8_context.h" 36 #include "chrome/renderer/extensions/chrome_v8_context.h"
45 #include "chrome/renderer/extensions/chrome_v8_extension.h" 37 #include "chrome/renderer/extensions/chrome_v8_extension.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 using WebKit::WebURLResponse; 126 using WebKit::WebURLResponse;
135 using WebKit::WebVector; 127 using WebKit::WebVector;
136 128
137 namespace { 129 namespace {
138 130
139 const char kWebViewTagName[] = "WEBVIEW"; 131 const char kWebViewTagName[] = "WEBVIEW";
140 const char kAdViewTagName[] = "ADVIEW"; 132 const char kAdViewTagName[] = "ADVIEW";
141 133
142 chrome::ChromeContentRendererClient* g_current_client; 134 chrome::ChromeContentRendererClient* g_current_client;
143 135
144 // Explicitly register all extension ManifestHandlers needed to parse
145 // fields used in the renderer.
146 void RegisterExtensionManifestHandlers() {
147 (new extensions::AppIsolationHandler)->Register();
148 (new extensions::BackgroundManifestHandler)->Register();
149 (new extensions::CSPHandler(false))->Register(); // not platform app.
150 (new extensions::CSPHandler(true))->Register(); // platform app.
151 (new extensions::DevToolsPageHandler)->Register();
152 (new extensions::IncognitoHandler)->Register();
153 (new extensions::PageActionHandler)->Register();
154 (new extensions::SandboxedPageHandler)->Register();
155 (new extensions::WebAccessibleResourcesHandler)->Register();
156 }
157
158 static void AppendParams(const std::vector<string16>& additional_names, 136 static void AppendParams(const std::vector<string16>& additional_names,
159 const std::vector<string16>& additional_values, 137 const std::vector<string16>& additional_values,
160 WebVector<WebString>* existing_names, 138 WebVector<WebString>* existing_names,
161 WebVector<WebString>* existing_values) { 139 WebVector<WebString>* existing_values) {
162 DCHECK(additional_names.size() == additional_values.size()); 140 DCHECK(additional_names.size() == additional_values.size());
163 DCHECK(existing_names->size() == existing_values->size()); 141 DCHECK(existing_names->size() == existing_values->size());
164 142
165 size_t existing_size = existing_names->size(); 143 size_t existing_size = existing_names->size();
166 size_t total_size = existing_size + additional_names.size(); 144 size_t total_size = existing_size + additional_names.size();
167 145
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // requests. 304 // requests.
327 WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_resource_scheme); 305 WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_resource_scheme);
328 306
329 // chrome-extension: resources should bypass Content Security Policy checks 307 // chrome-extension: resources should bypass Content Security Policy checks
330 // when included in protected resources. 308 // when included in protected resources.
331 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( 309 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(
332 extension_scheme); 310 extension_scheme);
333 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( 311 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(
334 extension_resource_scheme); 312 extension_resource_scheme);
335 313
336 extensions::ChromeAPIPermissions permissions;
337 extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( 314 extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate(
338 permissions); 315 extensions::ChromeAPIPermissions());
339 RegisterExtensionManifestHandlers(); 316 extensions::RegisterChromeManifestHandlers();
340 } 317 }
341 318
342 void ChromeContentRendererClient::RenderViewCreated( 319 void ChromeContentRendererClient::RenderViewCreated(
343 content::RenderView* render_view) { 320 content::RenderView* render_view) {
344 ContentSettingsObserver* content_settings = 321 ContentSettingsObserver* content_settings =
345 new ContentSettingsObserver(render_view); 322 new ContentSettingsObserver(render_view);
346 if (chrome_observer_.get()) { 323 if (chrome_observer_.get()) {
347 content_settings->SetContentSettingRules( 324 content_settings->SetContentSettingRules(
348 chrome_observer_->content_setting_rules()); 325 chrome_observer_->content_setting_rules());
349 } 326 }
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1151
1175 if (container->element().shadowHost().isNull()) 1152 if (container->element().shadowHost().isNull())
1176 return false; 1153 return false;
1177 1154
1178 WebString tag_name = container->element().shadowHost().tagName(); 1155 WebString tag_name = container->element().shadowHost().tagName();
1179 return tag_name.equals(WebString::fromUTF8(kWebViewTagName)) || 1156 return tag_name.equals(WebString::fromUTF8(kWebViewTagName)) ||
1180 tag_name.equals(WebString::fromUTF8(kAdViewTagName)); 1157 tag_name.equals(WebString::fromUTF8(kAdViewTagName));
1181 } 1158 }
1182 1159
1183 } // namespace chrome 1160 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/extensions/unpacker_unittest.cc ('k') | chrome/test/base/chrome_test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698