Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 1497743005: Allow huge data: URIs only via WebView.loadDataWithBaseUrl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test for serializing a huge data url Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/frame_host/navigation_entry_impl.h" 5 #include "content/browser/frame_host/navigation_entry_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 void NavigationEntryImpl::SetBaseURLForDataURL(const GURL& url) { 206 void NavigationEntryImpl::SetBaseURLForDataURL(const GURL& url) {
207 base_url_for_data_url_ = url; 207 base_url_for_data_url_ = url;
208 } 208 }
209 209
210 const GURL& NavigationEntryImpl::GetBaseURLForDataURL() const { 210 const GURL& NavigationEntryImpl::GetBaseURLForDataURL() const {
211 return base_url_for_data_url_; 211 return base_url_for_data_url_;
212 } 212 }
213 213
214 void NavigationEntryImpl::SetDataURLAsString(const std::string& url) {
215 data_url_as_string_ = url;
Charlie Reis 2015/12/10 20:43:46 Seems like we should be enforcing this starts with
mnaganov (inactive) 2015/12/11 23:14:23 Done in navigation_controller_android.
Charlie Reis 2015/12/14 20:35:56 That's a bit indirect-- navigation_controller_andr
216 }
217
218 const std::string& NavigationEntryImpl::GetDataURLAsString() const {
219 return data_url_as_string_;
220 }
221
214 void NavigationEntryImpl::SetReferrer(const Referrer& referrer) { 222 void NavigationEntryImpl::SetReferrer(const Referrer& referrer) {
215 frame_tree_->frame_entry->set_referrer(referrer); 223 frame_tree_->frame_entry->set_referrer(referrer);
216 } 224 }
217 225
218 const Referrer& NavigationEntryImpl::GetReferrer() const { 226 const Referrer& NavigationEntryImpl::GetReferrer() const {
219 return frame_tree_->frame_entry->referrer(); 227 return frame_tree_->frame_entry->referrer();
220 } 228 }
221 229
222 void NavigationEntryImpl::SetVirtualURL(const GURL& url) { 230 void NavigationEntryImpl::SetVirtualURL(const GURL& url) {
223 virtual_url_ = (url == GetURL()) ? GURL() : url; 231 virtual_url_ = (url == GetURL()) ? GURL() : url;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 copy->restore_type_ = restore_type_; 521 copy->restore_type_ = restore_type_;
514 copy->original_request_url_ = original_request_url_; 522 copy->original_request_url_ = original_request_url_;
515 copy->is_overriding_user_agent_ = is_overriding_user_agent_; 523 copy->is_overriding_user_agent_ = is_overriding_user_agent_;
516 copy->timestamp_ = timestamp_; 524 copy->timestamp_ = timestamp_;
517 copy->http_status_code_ = http_status_code_; 525 copy->http_status_code_ = http_status_code_;
518 // ResetForCommit: browser_initiated_post_data_ 526 // ResetForCommit: browser_initiated_post_data_
519 copy->screenshot_ = screenshot_; 527 copy->screenshot_ = screenshot_;
520 copy->extra_headers_ = extra_headers_; 528 copy->extra_headers_ = extra_headers_;
521 // ResetForCommit: source_site_instance_ 529 // ResetForCommit: source_site_instance_
522 copy->base_url_for_data_url_ = base_url_for_data_url_; 530 copy->base_url_for_data_url_ = base_url_for_data_url_;
531 copy->data_url_as_string_ = data_url_as_string_;
523 // ResetForCommit: is_renderer_initiated_ 532 // ResetForCommit: is_renderer_initiated_
524 copy->cached_display_title_ = cached_display_title_; 533 copy->cached_display_title_ = cached_display_title_;
525 // ResetForCommit: transferred_global_request_id_ 534 // ResetForCommit: transferred_global_request_id_
526 // ResetForCommit: should_replace_entry_ 535 // ResetForCommit: should_replace_entry_
527 copy->redirect_chain_ = redirect_chain_; 536 copy->redirect_chain_ = redirect_chain_;
528 // ResetForCommit: should_clear_history_list_ 537 // ResetForCommit: should_clear_history_list_
529 // ResetForCommit: frame_tree_node_id_ 538 // ResetForCommit: frame_tree_node_id_
530 // ResetForCommit: intent_received_timestamp_ 539 // ResetForCommit: intent_received_timestamp_
531 copy->extra_data_ = extra_data_; 540 copy->extra_data_ = extra_data_;
532 541
(...skipping 12 matching lines...) Expand all
545 base::TimeTicks ui_timestamp = base::TimeTicks(); 554 base::TimeTicks ui_timestamp = base::TimeTicks();
546 #if defined(OS_ANDROID) 555 #if defined(OS_ANDROID)
547 if (!intent_received_timestamp().is_null()) 556 if (!intent_received_timestamp().is_null())
548 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; 557 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT;
549 ui_timestamp = intent_received_timestamp(); 558 ui_timestamp = intent_received_timestamp();
550 #endif 559 #endif
551 560
552 return CommonNavigationParams( 561 return CommonNavigationParams(
553 dest_url, dest_referrer, GetTransitionType(), navigation_type, 562 dest_url, dest_referrer, GetTransitionType(), navigation_type,
554 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, 563 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type,
555 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, 564 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), GetDataURLAsString(),
556 navigation_start); 565 lofi_state, navigation_start);
557 } 566 }
558 567
559 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() 568 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams()
560 const { 569 const {
561 std::vector<unsigned char> browser_initiated_post_data; 570 std::vector<unsigned char> browser_initiated_post_data;
562 if (GetBrowserInitiatedPostData()) { 571 if (GetBrowserInitiatedPostData()) {
563 browser_initiated_post_data.assign( 572 browser_initiated_post_data.assign(
564 GetBrowserInitiatedPostData()->front(), 573 GetBrowserInitiatedPostData()->front(),
565 GetBrowserInitiatedPostData()->front() + 574 GetBrowserInitiatedPostData()->front() +
566 GetBrowserInitiatedPostData()->size()); 575 GetBrowserInitiatedPostData()->size());
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 return node; 733 return node;
725 } 734 }
726 // Enqueue any children and keep looking. 735 // Enqueue any children and keep looking.
727 for (auto& child : node->children) 736 for (auto& child : node->children)
728 work_queue.push(child); 737 work_queue.push(child);
729 } 738 }
730 return nullptr; 739 return nullptr;
731 } 740 }
732 741
733 } // namespace content 742 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698