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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "webkit/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 DCHECK(url.SchemeIs("data")); | 682 DCHECK(url.SchemeIs("data")); |
683 | 683 |
684 // Optimize for the case where we can handle a data URL locally. We must | 684 // Optimize for the case where we can handle a data URL locally. We must |
685 // skip this for data URLs targetted at frames since those could trigger a | 685 // skip this for data URLs targetted at frames since those could trigger a |
686 // download. | 686 // download. |
687 // | 687 // |
688 // NOTE: We special case MIME types we can render both for performance | 688 // NOTE: We special case MIME types we can render both for performance |
689 // reasons as well as to support unit tests, which do not have an underlying | 689 // reasons as well as to support unit tests, which do not have an underlying |
690 // ResourceLoaderBridge implementation. | 690 // ResourceLoaderBridge implementation. |
691 | 691 |
| 692 #if defined(OS_ANDROID) |
| 693 // For compatibility reasons on Android we need to expose top-level data:// |
| 694 // to the browser. |
| 695 if (request_.targetType() == WebURLRequest::TargetIsMainFrame) |
| 696 return false; |
| 697 #endif |
| 698 |
692 if (request_.targetType() != WebURLRequest::TargetIsMainFrame && | 699 if (request_.targetType() != WebURLRequest::TargetIsMainFrame && |
693 request_.targetType() != WebURLRequest::TargetIsSubframe) | 700 request_.targetType() != WebURLRequest::TargetIsSubframe) |
694 return true; | 701 return true; |
695 | 702 |
696 std::string mime_type, unused_charset; | 703 std::string mime_type, unused_charset; |
697 if (net::DataURL::Parse(url, &mime_type, &unused_charset, NULL) && | 704 if (net::DataURL::Parse(url, &mime_type, &unused_charset, NULL) && |
698 net::IsSupportedMimeType(mime_type)) | 705 net::IsSupportedMimeType(mime_type)) |
699 return true; | 706 return true; |
700 | 707 |
701 return false; | 708 return false; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 775 |
769 void WebURLLoaderImpl::setDefersLoading(bool value) { | 776 void WebURLLoaderImpl::setDefersLoading(bool value) { |
770 context_->SetDefersLoading(value); | 777 context_->SetDefersLoading(value); |
771 } | 778 } |
772 | 779 |
773 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | 780 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
774 context_->UpdateRoutingId(new_routing_id); | 781 context_->UpdateRoutingId(new_routing_id); |
775 } | 782 } |
776 | 783 |
777 } // namespace webkit_glue | 784 } // namespace webkit_glue |
OLD | NEW |