Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 // TODO(aa): This should be moved into ExtensionResourceRequestPolicy, but we | 322 // TODO(aa): This should be moved into ExtensionResourceRequestPolicy, but we |
| 323 // first need to find a way to get CanLoadInIncognito state into the renderers. | 323 // first need to find a way to get CanLoadInIncognito state into the renderers. |
| 324 bool AllowExtensionResourceLoad(net::URLRequest* request, | 324 bool AllowExtensionResourceLoad(net::URLRequest* request, |
| 325 bool is_incognito, | 325 bool is_incognito, |
| 326 const Extension* extension, | 326 const Extension* extension, |
| 327 extensions::InfoMap* extension_info_map) { | 327 extensions::InfoMap* extension_info_map) { |
| 328 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 328 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 329 | 329 |
| 330 // We have seen crashes where info is NULL: crbug.com/52374. | 330 // We have seen crashes where info is NULL: crbug.com/52374. |
| 331 if (!info) { | 331 if (!info) { |
| 332 LOG(ERROR) << "Allowing load of " << request->url().spec() | 332 // SeviceWorker net requests created through ServiceWorkerWriteToCacheJob |
| 333 << "from unknown origin. Could not find user data for " | 333 // does not have ResourceRequestInfo associated with them. So skip logging |
|
asargent_no_longer_on_chrome
2016/03/15 16:41:29
grammar nit: should be "... do not have..."
lazyboy
2016/03/16 19:48:25
Done.
| |
| 334 << "request."; | 334 // spurious errors below. |
| 335 // TODO(falken): Either consider attaching ResourceRequestInfo to these or | |
| 336 // finish refactoring ServiceWorkerWriteToCacheJob so that it doesn't spawn | |
| 337 // a new URLRequest. | |
| 338 if (!ResourceRequestInfo::OriginatedFromServiceWorker(request)) { | |
| 339 LOG(ERROR) << "Allowing load of " << request->url().spec() | |
| 340 << "from unknown origin. Could not find user data for " | |
| 341 << "request."; | |
| 342 } | |
| 335 return true; | 343 return true; |
| 336 } | 344 } |
| 337 | 345 |
| 338 if (is_incognito && !ExtensionCanLoadInIncognito( | 346 if (is_incognito && !ExtensionCanLoadInIncognito( |
| 339 info, request->url().host(), extension_info_map)) { | 347 info, request->url().host(), extension_info_map)) { |
| 340 return false; | 348 return false; |
| 341 } | 349 } |
| 342 | 350 |
| 343 // The following checks are meant to replicate similar set of checks in the | 351 // The following checks are meant to replicate similar set of checks in the |
| 344 // renderer process, performed by ResourceRequestPolicy::CanRequestResource. | 352 // renderer process, performed by ResourceRequestPolicy::CanRequestResource. |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 } | 576 } |
| 569 | 577 |
| 570 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 578 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 571 CreateExtensionProtocolHandler(bool is_incognito, | 579 CreateExtensionProtocolHandler(bool is_incognito, |
| 572 extensions::InfoMap* extension_info_map) { | 580 extensions::InfoMap* extension_info_map) { |
| 573 return make_scoped_ptr( | 581 return make_scoped_ptr( |
| 574 new ExtensionProtocolHandler(is_incognito, extension_info_map)); | 582 new ExtensionProtocolHandler(is_incognito, extension_info_map)); |
| 575 } | 583 } |
| 576 | 584 |
| 577 } // namespace extensions | 585 } // namespace extensions |
| OLD | NEW |