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

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

Issue 1104603002: Pick frame to navigate in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test cases Created 5 years, 8 months 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 "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/common/navigation_params.h" 10 #include "content/common/navigation_params.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 void NavigationEntryImpl::SetCanLoadLocalResources(bool allow) { 308 void NavigationEntryImpl::SetCanLoadLocalResources(bool allow) {
309 can_load_local_resources_ = allow; 309 can_load_local_resources_ = allow;
310 } 310 }
311 311
312 bool NavigationEntryImpl::GetCanLoadLocalResources() const { 312 bool NavigationEntryImpl::GetCanLoadLocalResources() const {
313 return can_load_local_resources_; 313 return can_load_local_resources_;
314 } 314 }
315 315
316 void NavigationEntryImpl::SetFrameToNavigate(const std::string& frame_name) {
317 frame_to_navigate_ = frame_name;
318 }
319
320 const std::string& NavigationEntryImpl::GetFrameToNavigate() const {
321 return frame_to_navigate_;
322 }
323
324 void NavigationEntryImpl::SetExtraData(const std::string& key, 316 void NavigationEntryImpl::SetExtraData(const std::string& key,
325 const base::string16& data) { 317 const base::string16& data) {
326 extra_data_[key] = data; 318 extra_data_[key] = data;
327 } 319 }
328 320
329 bool NavigationEntryImpl::GetExtraData(const std::string& key, 321 bool NavigationEntryImpl::GetExtraData(const std::string& key,
330 base::string16* data) const { 322 base::string16* data) const {
331 std::map<std::string, base::string16>::const_iterator iter = 323 std::map<std::string, base::string16>::const_iterator iter =
332 extra_data_.find(key); 324 extra_data_.find(key);
333 if (iter == extra_data_.end()) 325 if (iter == extra_data_.end())
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 copy->screenshot_ = screenshot_; 363 copy->screenshot_ = screenshot_;
372 copy->extra_headers_ = extra_headers_; 364 copy->extra_headers_ = extra_headers_;
373 // ResetForCommit: source_site_instance_ 365 // ResetForCommit: source_site_instance_
374 copy->base_url_for_data_url_ = base_url_for_data_url_; 366 copy->base_url_for_data_url_ = base_url_for_data_url_;
375 // ResetForCommit: is_renderer_initiated_ 367 // ResetForCommit: is_renderer_initiated_
376 copy->cached_display_title_ = cached_display_title_; 368 copy->cached_display_title_ = cached_display_title_;
377 // ResetForCommit: transferred_global_request_id_ 369 // ResetForCommit: transferred_global_request_id_
378 // ResetForCommit: should_replace_entry_ 370 // ResetForCommit: should_replace_entry_
379 copy->redirect_chain_ = redirect_chain_; 371 copy->redirect_chain_ = redirect_chain_;
380 // ResetForCommit: should_clear_history_list_ 372 // ResetForCommit: should_clear_history_list_
381 copy->frame_to_navigate_ = frame_to_navigate_;
382 // ResetForCommit: frame_tree_node_id_ 373 // ResetForCommit: frame_tree_node_id_
383 // ResetForCommit: intent_received_timestamp_ 374 // ResetForCommit: intent_received_timestamp_
384 copy->extra_data_ = extra_data_; 375 copy->extra_data_ = extra_data_;
385 376
386 return copy; 377 return copy;
387 } 378 }
388 379
389 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( 380 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams(
390 FrameMsg_Navigate_Type::Value navigation_type) const { 381 FrameMsg_Navigate_Type::Value navigation_type) const {
391 FrameMsg_UILoadMetricsReportType::Value report_type = 382 FrameMsg_UILoadMetricsReportType::Value report_type =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 if (should_clear_history_list()) { 428 if (should_clear_history_list()) {
438 // Set the history list related parameters to the same values a 429 // Set the history list related parameters to the same values a
439 // NavigationController would return before its first navigation. This will 430 // NavigationController would return before its first navigation. This will
440 // fully clear the RenderView's view of the session history. 431 // fully clear the RenderView's view of the session history.
441 pending_offset_to_send = -1; 432 pending_offset_to_send = -1;
442 current_offset_to_send = -1; 433 current_offset_to_send = -1;
443 current_length_to_send = 0; 434 current_length_to_send = 0;
444 } 435 }
445 return RequestNavigationParams( 436 return RequestNavigationParams(
446 GetIsOverridingUserAgent(), navigation_start, redirects, 437 GetIsOverridingUserAgent(), navigation_start, redirects,
447 GetCanLoadLocalResources(), GetFrameToNavigate(), base::Time::Now(), 438 GetCanLoadLocalResources(), base::Time::Now(), GetPageState(),
448 GetPageState(), GetPageID(), pending_offset_to_send, 439 GetPageID(), pending_offset_to_send, current_offset_to_send,
449 current_offset_to_send, current_length_to_send, 440 current_length_to_send, should_clear_history_list());
450 should_clear_history_list());
451 } 441 }
452 442
453 void NavigationEntryImpl::ResetForCommit() { 443 void NavigationEntryImpl::ResetForCommit() {
454 // Any state that only matters when a navigation entry is pending should be 444 // Any state that only matters when a navigation entry is pending should be
455 // cleared here. 445 // cleared here.
456 // TODO(creis): This state should be moved to NavigationRequest once 446 // TODO(creis): This state should be moved to NavigationRequest once
457 // PlzNavigate is enabled. 447 // PlzNavigate is enabled.
458 SetBrowserInitiatedPostData(nullptr); 448 SetBrowserInitiatedPostData(nullptr);
459 set_source_site_instance(nullptr); 449 set_source_site_instance(nullptr);
460 set_is_renderer_initiated(false); 450 set_is_renderer_initiated(false);
(...skipping 27 matching lines...) Expand all
488 screenshot_ = png_data; 478 screenshot_ = png_data;
489 if (screenshot_.get()) 479 if (screenshot_.get())
490 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); 480 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size());
491 } 481 }
492 482
493 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { 483 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const {
494 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); 484 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL();
495 } 485 }
496 486
497 } // namespace content 487 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_entry_impl.h ('k') | content/browser/frame_host/navigation_entry_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698