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