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/browser/extension_protocols.h" | 5 #include "extensions/browser/extension_protocols.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 if (directory_path.value().empty()) { | 404 if (directory_path.value().empty()) { |
405 LOG(WARNING) << "Failed to GetPathForExtension: " << extension_id; | 405 LOG(WARNING) << "Failed to GetPathForExtension: " << extension_id; |
406 return NULL; | 406 return NULL; |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 // Set up content security policy. | 410 // Set up content security policy. |
411 std::string content_security_policy; | 411 std::string content_security_policy; |
412 bool send_cors_header = false; | 412 bool send_cors_header = false; |
413 bool follow_symlinks_anywhere = false; | 413 bool follow_symlinks_anywhere = false; |
| 414 |
414 if (extension) { | 415 if (extension) { |
415 std::string resource_path = request->url().path(); | 416 std::string resource_path = request->url().path(); |
416 content_security_policy = | 417 |
417 extensions::CSPInfo::GetResourceContentSecurityPolicy(extension, | 418 // Use default CSP for <webview>. |
418 resource_path); | 419 if (!ExtensionsBrowserClient::Get()->IsWebViewRequest(request)) { |
| 420 content_security_policy = |
| 421 extensions::CSPInfo::GetResourceContentSecurityPolicy(extension, |
| 422 resource_path); |
| 423 } |
| 424 |
419 if ((extension->manifest_version() >= 2 || | 425 if ((extension->manifest_version() >= 2 || |
420 extensions::WebAccessibleResourcesInfo::HasWebAccessibleResources( | 426 extensions::WebAccessibleResourcesInfo::HasWebAccessibleResources( |
421 extension)) && | 427 extension)) && |
422 extensions::WebAccessibleResourcesInfo::IsResourceWebAccessible( | 428 extensions::WebAccessibleResourcesInfo::IsResourceWebAccessible( |
423 extension, resource_path)) | 429 extension, resource_path)) { |
424 send_cors_header = true; | 430 send_cors_header = true; |
| 431 } |
425 | 432 |
426 follow_symlinks_anywhere = | 433 follow_symlinks_anywhere = |
427 (extension->creation_flags() & Extension::FOLLOW_SYMLINKS_ANYWHERE) | 434 (extension->creation_flags() & Extension::FOLLOW_SYMLINKS_ANYWHERE) |
428 != 0; | 435 != 0; |
429 } | 436 } |
430 | 437 |
431 // Create a job for a generated background page. | 438 // Create a job for a generated background page. |
432 std::string path = request->url().path(); | 439 std::string path = request->url().path(); |
433 if (path.size() > 1 && | 440 if (path.size() > 1 && |
434 path.substr(1) == extensions::kGeneratedBackgroundPageFilename) { | 441 path.substr(1) == extensions::kGeneratedBackgroundPageFilename) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 return new net::HttpResponseHeaders(raw_headers); | 545 return new net::HttpResponseHeaders(raw_headers); |
539 } | 546 } |
540 | 547 |
541 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( | 548 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( |
542 bool is_incognito, | 549 bool is_incognito, |
543 extensions::InfoMap* extension_info_map) { | 550 extensions::InfoMap* extension_info_map) { |
544 return new ExtensionProtocolHandler(is_incognito, extension_info_map); | 551 return new ExtensionProtocolHandler(is_incognito, extension_info_map); |
545 } | 552 } |
546 | 553 |
547 } // namespace extensions | 554 } // namespace extensions |
OLD | NEW |