| 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/browser/extensions/extension_protocols.h" | 5 #include "chrome/browser/extensions/extension_protocols.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 directory_path = disabled_extension->path(); | 271 directory_path = disabled_extension->path(); |
| 272 if (directory_path.value().empty()) { | 272 if (directory_path.value().empty()) { |
| 273 LOG(WARNING) << "Failed to GetPathForExtension: " << extension_id; | 273 LOG(WARNING) << "Failed to GetPathForExtension: " << extension_id; |
| 274 return NULL; | 274 return NULL; |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 std::string content_security_policy; | 278 std::string content_security_policy; |
| 279 bool send_cors_header = false; | 279 bool send_cors_header = false; |
| 280 if (extension) { | 280 if (extension) { |
| 281 content_security_policy = extension->content_security_policy(); | 281 std::string resource_path = request->url().path(); |
| 282 content_security_policy = |
| 283 extension->GetResourceContentSecurityPolicy(resource_path); |
| 282 if ((extension->manifest_version() >= 2 || | 284 if ((extension->manifest_version() >= 2 || |
| 283 extension->HasWebAccessibleResources()) && | 285 extension->HasWebAccessibleResources()) && |
| 284 extension->IsResourceWebAccessible(request->url().path())) | 286 extension->IsResourceWebAccessible(resource_path)) |
| 285 send_cors_header = true; | 287 send_cors_header = true; |
| 286 } | 288 } |
| 287 | 289 |
| 288 std::string path = request->url().path(); | 290 std::string path = request->url().path(); |
| 289 if (path.size() > 1 && | 291 if (path.size() > 1 && |
| 290 path.substr(1) == extension_filenames::kGeneratedBackgroundPageFilename) { | 292 path.substr(1) == extension_filenames::kGeneratedBackgroundPageFilename) { |
| 291 return new GeneratedBackgroundPageJob( | 293 return new GeneratedBackgroundPageJob( |
| 292 request, extension, content_security_policy); | 294 request, extension, content_security_policy); |
| 293 } | 295 } |
| 294 | 296 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 content_security_policy, send_cors_header); | 339 content_security_policy, send_cors_header); |
| 338 } | 340 } |
| 339 | 341 |
| 340 } // namespace | 342 } // namespace |
| 341 | 343 |
| 342 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( | 344 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( |
| 343 bool is_incognito, | 345 bool is_incognito, |
| 344 ExtensionInfoMap* extension_info_map) { | 346 ExtensionInfoMap* extension_info_map) { |
| 345 return new ExtensionProtocolHandler(is_incognito, extension_info_map); | 347 return new ExtensionProtocolHandler(is_incognito, extension_info_map); |
| 346 } | 348 } |
| OLD | NEW |