Chromium Code Reviews| 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 = extension->IsResourceSandboxed(resource_path) ? | |
|
Aaron Boodman
2012/06/04 07:05:42
It's kinda a shame that this doesn't pick up any o
Mihai Parparita -not on Chrome
2012/06/04 18:27:02
BTW, the content_security_policy manifest value is
| |
| 283 extension_misc::kSandboxedContentSecurityPolicy : | |
| 284 extension->content_security_policy(); | |
| 282 if ((extension->manifest_version() >= 2 || | 285 if ((extension->manifest_version() >= 2 || |
| 283 extension->HasWebAccessibleResources()) && | 286 extension->HasWebAccessibleResources()) && |
| 284 extension->IsResourceWebAccessible(request->url().path())) | 287 extension->IsResourceWebAccessible(resource_path)) |
| 285 send_cors_header = true; | 288 send_cors_header = true; |
| 286 } | 289 } |
| 287 | 290 |
| 288 std::string path = request->url().path(); | 291 std::string path = request->url().path(); |
| 289 if (path.size() > 1 && | 292 if (path.size() > 1 && |
| 290 path.substr(1) == extension_filenames::kGeneratedBackgroundPageFilename) { | 293 path.substr(1) == extension_filenames::kGeneratedBackgroundPageFilename) { |
| 291 return new GeneratedBackgroundPageJob( | 294 return new GeneratedBackgroundPageJob( |
| 292 request, extension, content_security_policy); | 295 request, extension, content_security_policy); |
| 293 } | 296 } |
| 294 | 297 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 content_security_policy, send_cors_header); | 340 content_security_policy, send_cors_header); |
| 338 } | 341 } |
| 339 | 342 |
| 340 } // namespace | 343 } // namespace |
| 341 | 344 |
| 342 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( | 345 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( |
| 343 bool is_incognito, | 346 bool is_incognito, |
| 344 ExtensionInfoMap* extension_info_map) { | 347 ExtensionInfoMap* extension_info_map) { |
| 345 return new ExtensionProtocolHandler(is_incognito, extension_info_map); | 348 return new ExtensionProtocolHandler(is_incognito, extension_info_map); |
| 346 } | 349 } |
| OLD | NEW |