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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 DCHECK_NE(params.page_id, -1); | 1586 DCHECK_NE(params.page_id, -1); |
1587 WebHistoryItem item = PageStateToHistoryItem(params.page_state); | 1587 WebHistoryItem item = PageStateToHistoryItem(params.page_state); |
1588 if (!item.isNull()) { | 1588 if (!item.isNull()) { |
1589 // Ensure we didn't save the swapped out URL in UpdateState, since the | 1589 // Ensure we didn't save the swapped out URL in UpdateState, since the |
1590 // browser should never be telling us to navigate to swappedout://. | 1590 // browser should never be telling us to navigate to swappedout://. |
1591 CHECK(item.urlString() != WebString::fromUTF8(kSwappedOutURL)); | 1591 CHECK(item.urlString() != WebString::fromUTF8(kSwappedOutURL)); |
1592 frame->loadHistoryItem(item); | 1592 frame->loadHistoryItem(item); |
1593 } | 1593 } |
1594 } else if (!params.base_url_for_data_url.is_empty()) { | 1594 } else if (!params.base_url_for_data_url.is_empty()) { |
1595 // A loadData request with a specified base URL. | 1595 // A loadData request with a specified base URL. |
1596 std::string mime_type, charset, data; | 1596 std::string mime_type, charset; |
1597 if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { | 1597 if (!net::DataURL::Parse(params.url, &mime_type, &charset, NULL)) { |
1598 frame->loadData( | |
1599 WebData(data.c_str(), data.length()), | |
1600 WebString::fromUTF8(mime_type), | |
1601 WebString::fromUTF8(charset), | |
1602 params.base_url_for_data_url, | |
1603 params.history_url_for_data_url, | |
1604 false); | |
1605 } else { | |
1606 CHECK(false) << | 1598 CHECK(false) << |
1607 "Invalid URL passed: " << params.url.possibly_invalid_spec(); | 1599 "Invalid URL passed: " << params.url.possibly_invalid_spec(); |
1608 } | 1600 } |
| 1601 WebData data; |
| 1602 if (params.data_for_data_url.get()) { |
| 1603 data.assign( |
| 1604 reinterpret_cast<const char*>(params.data_for_data_url->front()), |
| 1605 params.data_for_data_url->size()); |
| 1606 } |
| 1607 frame->loadData(data, |
| 1608 WebString::fromUTF8(mime_type), |
| 1609 WebString::fromUTF8(charset), |
| 1610 params.base_url_for_data_url, |
| 1611 params.history_url_for_data_url, |
| 1612 false); |
1609 } else { | 1613 } else { |
1610 // Navigate to the given URL. | 1614 // Navigate to the given URL. |
1611 WebURLRequest request(params.url); | 1615 WebURLRequest request(params.url); |
1612 | 1616 |
1613 // A session history navigation should have been accompanied by state. | 1617 // A session history navigation should have been accompanied by state. |
1614 CHECK_EQ(params.page_id, -1); | 1618 CHECK_EQ(params.page_id, -1); |
1615 | 1619 |
1616 if (frame->isViewSourceModeEnabled()) | 1620 if (frame->isViewSourceModeEnabled()) |
1617 request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); | 1621 request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); |
1618 | 1622 |
(...skipping 5060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6679 for (size_t i = 0; i < icon_urls.size(); i++) { | 6683 for (size_t i = 0; i < icon_urls.size(); i++) { |
6680 WebURL url = icon_urls[i].iconURL(); | 6684 WebURL url = icon_urls[i].iconURL(); |
6681 if (!url.isEmpty()) | 6685 if (!url.isEmpty()) |
6682 urls.push_back(FaviconURL(url, | 6686 urls.push_back(FaviconURL(url, |
6683 ToFaviconType(icon_urls[i].iconType()))); | 6687 ToFaviconType(icon_urls[i].iconType()))); |
6684 } | 6688 } |
6685 SendUpdateFaviconURL(urls); | 6689 SendUpdateFaviconURL(urls); |
6686 } | 6690 } |
6687 | 6691 |
6688 } // namespace content | 6692 } // namespace content |
OLD | NEW |