OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/navigation_controller.h" | 5 #include "content/browser/tab_contents/navigation_controller.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" // Temporary | 9 #include "base/string_number_conversions.h" // Temporary |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 bool is_current = index == last_committed_entry_index_; | 465 bool is_current = index == last_committed_entry_index_; |
466 RemoveEntryAtIndexInternal(index); | 466 RemoveEntryAtIndexInternal(index); |
467 if (is_current) { | 467 if (is_current) { |
468 // We removed the currently shown entry, so we have to load something else. | 468 // We removed the currently shown entry, so we have to load something else. |
469 if (last_committed_entry_index_ != -1) { | 469 if (last_committed_entry_index_ != -1) { |
470 pending_entry_index_ = last_committed_entry_index_; | 470 pending_entry_index_ = last_committed_entry_index_; |
471 NavigateToPendingEntry(NO_RELOAD); | 471 NavigateToPendingEntry(NO_RELOAD); |
472 } else { | 472 } else { |
473 // If there is nothing to show, show a default page. | 473 // If there is nothing to show, show a default page. |
474 LoadURL(default_url.is_empty() ? GURL("about:blank") : default_url, | 474 LoadURL(default_url.is_empty() ? GURL("about:blank") : default_url, |
475 GURL(), content::PAGE_TRANSITION_START_PAGE, std::string()); | 475 content::Referrer(), content::PAGE_TRANSITION_START_PAGE, |
| 476 std::string()); |
476 } | 477 } |
477 } | 478 } |
478 } | 479 } |
479 | 480 |
480 void NavigationController::UpdateVirtualURLToURL( | 481 void NavigationController::UpdateVirtualURLToURL( |
481 NavigationEntry* entry, const GURL& new_url) { | 482 NavigationEntry* entry, const GURL& new_url) { |
482 GURL new_virtual_url(new_url); | 483 GURL new_virtual_url(new_url); |
483 if (BrowserURLHandler::GetInstance()->ReverseURLRewrite( | 484 if (BrowserURLHandler::GetInstance()->ReverseURLRewrite( |
484 &new_virtual_url, entry->virtual_url(), browser_context_)) { | 485 &new_virtual_url, entry->virtual_url(), browser_context_)) { |
485 entry->set_virtual_url(new_virtual_url); | 486 entry->set_virtual_url(new_virtual_url); |
(...skipping 25 matching lines...) Expand all Loading... |
511 is_renderer_initiated, | 512 is_renderer_initiated, |
512 extra_headers, | 513 extra_headers, |
513 browser_context_); | 514 browser_context_); |
514 entry->set_transferred_global_request_id(transferred_global_request_id); | 515 entry->set_transferred_global_request_id(transferred_global_request_id); |
515 | 516 |
516 LoadEntry(entry); | 517 LoadEntry(entry); |
517 } | 518 } |
518 | 519 |
519 void NavigationController::LoadURL( | 520 void NavigationController::LoadURL( |
520 const GURL& url, | 521 const GURL& url, |
521 const GURL& referrer, | 522 const content::Referrer& referrer, |
522 content::PageTransition transition, | 523 content::PageTransition transition, |
523 const std::string& extra_headers) { | 524 const std::string& extra_headers) { |
524 // The user initiated a load, we don't need to reload anymore. | 525 // The user initiated a load, we don't need to reload anymore. |
525 needs_reload_ = false; | 526 needs_reload_ = false; |
526 | 527 |
527 NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, | 528 NavigationEntry* entry = CreateNavigationEntry(url, referrer.url, transition, |
528 false, | 529 false, |
529 extra_headers, | 530 extra_headers, |
530 browser_context_); | 531 browser_context_); |
531 | 532 |
532 LoadEntry(entry); | 533 LoadEntry(entry); |
533 } | 534 } |
534 | 535 |
535 void NavigationController::LoadURLFromRenderer( | 536 void NavigationController::LoadURLFromRenderer( |
536 const GURL& url, | 537 const GURL& url, |
537 const GURL& referrer, | 538 const content::Referrer& referrer, |
538 content::PageTransition transition, | 539 content::PageTransition transition, |
539 const std::string& extra_headers) { | 540 const std::string& extra_headers) { |
540 // The user initiated a load, we don't need to reload anymore. | 541 // The user initiated a load, we don't need to reload anymore. |
541 needs_reload_ = false; | 542 needs_reload_ = false; |
542 | 543 |
543 NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, | 544 NavigationEntry* entry = CreateNavigationEntry(url, referrer.url, transition, |
544 true, | 545 true, |
545 extra_headers, | 546 extra_headers, |
546 browser_context_); | 547 browser_context_); |
547 | 548 |
548 LoadEntry(entry); | 549 LoadEntry(entry); |
549 } | 550 } |
550 | 551 |
551 void NavigationController::DocumentLoadedInFrame() { | 552 void NavigationController::DocumentLoadedInFrame() { |
552 last_document_loaded_ = base::TimeTicks::Now(); | 553 last_document_loaded_ = base::TimeTicks::Now(); |
553 } | 554 } |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 for (int i = 0; i < max_index; i++) { | 1282 for (int i = 0; i < max_index; i++) { |
1282 // When cloning a tab, copy all entries except interstitial pages | 1283 // When cloning a tab, copy all entries except interstitial pages |
1283 if (source.entries_[i].get()->page_type() != | 1284 if (source.entries_[i].get()->page_type() != |
1284 content::PAGE_TYPE_INTERSTITIAL) { | 1285 content::PAGE_TYPE_INTERSTITIAL) { |
1285 entries_.insert(entries_.begin() + insert_index++, | 1286 entries_.insert(entries_.begin() + insert_index++, |
1286 linked_ptr<NavigationEntry>( | 1287 linked_ptr<NavigationEntry>( |
1287 new NavigationEntry(*source.entries_[i]))); | 1288 new NavigationEntry(*source.entries_[i]))); |
1288 } | 1289 } |
1289 } | 1290 } |
1290 } | 1291 } |
OLD | NEW |