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

Side by Side Diff: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc

Issue 1866103002: [Extensions] Expand bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/renderer/extensions/tabs_custom_bindings.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 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 "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" 5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.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/sha1.h" 10 #include "base/sha1.h"
(...skipping 21 matching lines...) Expand all
32 #include "content/public/renderer/render_thread.h" 32 #include "content/public/renderer/render_thread.h"
33 #include "content/public/renderer/render_view.h" 33 #include "content/public/renderer/render_view.h"
34 #include "extensions/common/constants.h" 34 #include "extensions/common/constants.h"
35 #include "extensions/common/extension.h" 35 #include "extensions/common/extension.h"
36 #include "extensions/common/feature_switch.h" 36 #include "extensions/common/feature_switch.h"
37 #include "extensions/common/permissions/manifest_permission_set.h" 37 #include "extensions/common/permissions/manifest_permission_set.h"
38 #include "extensions/common/permissions/permission_set.h" 38 #include "extensions/common/permissions/permission_set.h"
39 #include "extensions/common/permissions/permissions_data.h" 39 #include "extensions/common/permissions/permissions_data.h"
40 #include "extensions/common/switches.h" 40 #include "extensions/common/switches.h"
41 #include "extensions/renderer/dispatcher.h" 41 #include "extensions/renderer/dispatcher.h"
42 #include "extensions/renderer/i18n_custom_bindings.h"
43 #include "extensions/renderer/lazy_background_page_native_handler.h"
42 #include "extensions/renderer/native_handler.h" 44 #include "extensions/renderer/native_handler.h"
43 #include "extensions/renderer/resource_bundle_source_map.h" 45 #include "extensions/renderer/resource_bundle_source_map.h"
44 #include "extensions/renderer/script_context.h" 46 #include "extensions/renderer/script_context.h"
45 #include "third_party/WebKit/public/platform/WebString.h" 47 #include "third_party/WebKit/public/platform/WebString.h"
46 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 48 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
47 49
48 #if defined(ENABLE_WEBRTC) 50 #if defined(ENABLE_WEBRTC)
49 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" 51 #include "chrome/renderer/extensions/cast_streaming_native_handler.h"
50 #endif 52 #endif
51 53
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 #if defined(ENABLE_WEBRTC) 119 #if defined(ENABLE_WEBRTC)
118 module_system->RegisterNativeHandler( 120 module_system->RegisterNativeHandler(
119 "cast_streaming_natives", 121 "cast_streaming_natives",
120 std::unique_ptr<NativeHandler>( 122 std::unique_ptr<NativeHandler>(
121 new extensions::CastStreamingNativeHandler(context))); 123 new extensions::CastStreamingNativeHandler(context)));
122 #endif 124 #endif
123 module_system->RegisterNativeHandler( 125 module_system->RegisterNativeHandler(
124 "automationInternal", 126 "automationInternal",
125 std::unique_ptr<NativeHandler>( 127 std::unique_ptr<NativeHandler>(
126 new extensions::AutomationInternalCustomBindings(context))); 128 new extensions::AutomationInternalCustomBindings(context)));
129
130 // The following are native handlers that are defined in //extensions, but
131 // are only used for APIs defined in Chrome.
132 // TODO(devlin): We should clean this up. If an API is defined in Chrome,
133 // there's no reason to have its native handlers residing and being compiled
134 // in //extensions.
135 module_system->RegisterNativeHandler(
136 "i18n",
137 scoped_ptr<NativeHandler>(new extensions::I18NCustomBindings(context)));
138 module_system->RegisterNativeHandler(
139 "lazy_background_page",
140 scoped_ptr<NativeHandler>(
141 new extensions::LazyBackgroundPageNativeHandler(context)));
127 } 142 }
128 143
129 void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( 144 void ChromeExtensionsDispatcherDelegate::PopulateSourceMap(
130 extensions::ResourceBundleSourceMap* source_map) { 145 extensions::ResourceBundleSourceMap* source_map) {
131 // Custom bindings. 146 // Custom bindings.
132 source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS); 147 source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS);
133 source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS); 148 source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS);
134 source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS); 149 source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS);
135 source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS); 150 source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS);
136 source_map->RegisterSource("browserAction", 151 source_map->RegisterSource("browserAction",
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 278 }
264 279
265 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) { 280 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) {
266 extensions::SetCurrentChannel(static_cast<version_info::Channel>(channel)); 281 extensions::SetCurrentChannel(static_cast<version_info::Channel>(channel));
267 if (extensions::feature_util::ExtensionServiceWorkersEnabled()) { 282 if (extensions::feature_util::ExtensionServiceWorkersEnabled()) {
268 // chrome-extension: resources should be allowed to register ServiceWorkers. 283 // chrome-extension: resources should be allowed to register ServiceWorkers.
269 blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( 284 blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(
270 blink::WebString::fromUTF8(extensions::kExtensionScheme)); 285 blink::WebString::fromUTF8(extensions::kExtensionScheme));
271 } 286 }
272 } 287 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/tabs_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698