| OLD | NEW |
| 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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // ExtensionAPIEnabledInExtensionServiceWorkers(), but the Dispatcher is | 262 // ExtensionAPIEnabledInExtensionServiceWorkers(), but the Dispatcher is |
| 263 // created so early that sending an IPC from browser/ process to synchronize | 263 // created so early that sending an IPC from browser/ process to synchronize |
| 264 // this enabled-ness is too late. | 264 // this enabled-ness is too late. |
| 265 WorkerThreadDispatcher::Get()->Init(RenderThread::Get()); | 265 WorkerThreadDispatcher::Get()->Init(RenderThread::Get()); |
| 266 | 266 |
| 267 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension()); | 267 RenderThread::Get()->RegisterExtension(SafeBuiltins::CreateV8Extension()); |
| 268 | 268 |
| 269 // Register WebSecurityPolicy whitelists for the chrome-extension:// scheme. | 269 // Register WebSecurityPolicy whitelists for the chrome-extension:// scheme. |
| 270 WebString extension_scheme(WebString::fromASCII(kExtensionScheme)); | 270 WebString extension_scheme(WebString::fromASCII(kExtensionScheme)); |
| 271 | 271 |
| 272 // Resources should bypass Content Security Policy checks when included in | |
| 273 // protected resources. TODO(kalman): What are "protected resources"? | |
| 274 WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( | |
| 275 extension_scheme); | |
| 276 | |
| 277 // Extension resources are HTTP-like and safe to expose to the fetch API. The | 272 // Extension resources are HTTP-like and safe to expose to the fetch API. The |
| 278 // rules for the fetch API are consistent with XHR. | 273 // rules for the fetch API are consistent with XHR. |
| 279 WebSecurityPolicy::registerURLSchemeAsSupportingFetchAPI(extension_scheme); | 274 WebSecurityPolicy::registerURLSchemeAsSupportingFetchAPI(extension_scheme); |
| 280 | 275 |
| 281 // Extension resources, when loaded as the top-level document, should bypass | 276 // Extension resources, when loaded as the top-level document, should bypass |
| 282 // Blink's strict first-party origin checks. | 277 // Blink's strict first-party origin checks. |
| 283 WebSecurityPolicy::registerURLSchemeAsFirstPartyWhenTopLevel( | 278 WebSecurityPolicy::registerURLSchemeAsFirstPartyWhenTopLevel( |
| 284 extension_scheme); | 279 extension_scheme); |
| 285 | 280 |
| 286 // For extensions, we want to ensure we call the IdleHandler every so often, | 281 // For extensions, we want to ensure we call the IdleHandler every so often, |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 // The "guestViewDeny" module must always be loaded last. It registers | 1403 // The "guestViewDeny" module must always be loaded last. It registers |
| 1409 // error-providing custom elements for the GuestView types that are not | 1404 // error-providing custom elements for the GuestView types that are not |
| 1410 // available, and thus all of those types must have been checked and loaded | 1405 // available, and thus all of those types must have been checked and loaded |
| 1411 // (or not loaded) beforehand. | 1406 // (or not loaded) beforehand. |
| 1412 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1407 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
| 1413 module_system->Require("guestViewDeny"); | 1408 module_system->Require("guestViewDeny"); |
| 1414 } | 1409 } |
| 1415 } | 1410 } |
| 1416 | 1411 |
| 1417 } // namespace extensions | 1412 } // namespace extensions |
| OLD | NEW |