| 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_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 553 |
| 554 // All committed entries should have nonempty content state so WebKit doesn't | 554 // All committed entries should have nonempty content state so WebKit doesn't |
| 555 // get confused when we go back to them (see the function for details). | 555 // get confused when we go back to them (see the function for details). |
| 556 DCHECK(!params.content_state.empty()); | 556 DCHECK(!params.content_state.empty()); |
| 557 NavigationEntry* active_entry = GetActiveEntry(); | 557 NavigationEntry* active_entry = GetActiveEntry(); |
| 558 active_entry->set_content_state(params.content_state); | 558 active_entry->set_content_state(params.content_state); |
| 559 | 559 |
| 560 // The active entry's SiteInstance should match our SiteInstance. | 560 // The active entry's SiteInstance should match our SiteInstance. |
| 561 DCHECK(active_entry->site_instance() == tab_contents_->GetSiteInstance()); | 561 DCHECK(active_entry->site_instance() == tab_contents_->GetSiteInstance()); |
| 562 | 562 |
| 563 // WebKit doesn't set the "auto" transition on meta refreshes properly (bug | |
| 564 // 1051891) so we manually set it for redirects which we normally treat as | |
| 565 // "non-user-gestures" where we want to update stuff after navigations. | |
| 566 // | |
| 567 // Note that the redirect check also checks for a pending entry to | |
| 568 // differentiate real redirects from browser initiated navigations to a | |
| 569 // redirected entry. This happens when you hit back to go to a page that was | |
| 570 // the destination of a redirect, we don't want to treat it as a redirect | |
| 571 // even though that's what its transition will be. See bug 1117048. | |
| 572 // | |
| 573 // TODO(brettw) write a test for this complicated logic. | |
| 574 details->is_auto = (PageTransition::IsRedirect(params.transition) && | |
| 575 !pending_entry()) || | |
| 576 params.gesture == NavigationGestureAuto; | |
| 577 | |
| 578 // Now prep the rest of the details for the notification and broadcast. | 563 // Now prep the rest of the details for the notification and broadcast. |
| 579 details->entry = active_entry; | 564 details->entry = active_entry; |
| 580 details->is_main_frame = PageTransition::IsMainFrame(params.transition); | 565 details->is_main_frame = PageTransition::IsMainFrame(params.transition); |
| 581 details->serialized_security_info = params.security_info; | 566 details->serialized_security_info = params.security_info; |
| 582 details->http_status_code = params.http_status_code; | 567 details->http_status_code = params.http_status_code; |
| 583 NotifyNavigationEntryCommitted(details); | 568 NotifyNavigationEntryCommitted(details); |
| 584 | 569 |
| 585 return true; | 570 return true; |
| 586 } | 571 } |
| 587 | 572 |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 size_t insert_index = 0; | 1149 size_t insert_index = 0; |
| 1165 for (int i = 0; i < max_index; i++) { | 1150 for (int i = 0; i < max_index; i++) { |
| 1166 // When cloning a tab, copy all entries except interstitial pages | 1151 // When cloning a tab, copy all entries except interstitial pages |
| 1167 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { | 1152 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { |
| 1168 entries_.insert(entries_.begin() + insert_index++, | 1153 entries_.insert(entries_.begin() + insert_index++, |
| 1169 linked_ptr<NavigationEntry>( | 1154 linked_ptr<NavigationEntry>( |
| 1170 new NavigationEntry(*source.entries_[i]))); | 1155 new NavigationEntry(*source.entries_[i]))); |
| 1171 } | 1156 } |
| 1172 } | 1157 } |
| 1173 } | 1158 } |
| OLD | NEW |