Chromium Code Reviews| 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/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 FOR_EACH_OBSERVER(TabContentsObserver, | 589 FOR_EACH_OBSERVER(TabContentsObserver, |
| 590 observers_, | 590 observers_, |
| 591 NavigateToPendingEntry(entry.url(), reload_type)); | 591 NavigateToPendingEntry(entry.url(), reload_type)); |
| 592 | 592 |
| 593 if (delegate_) | 593 if (delegate_) |
| 594 delegate_->DidNavigateToPendingEntry(this); | 594 delegate_->DidNavigateToPendingEntry(this); |
| 595 | 595 |
| 596 return true; | 596 return true; |
| 597 } | 597 } |
| 598 | 598 |
| 599 void TabContents::SetHistoryLengthAndClear(int history_length) { | 599 void TabContents::SetHistoryLengthAndPrune(const SiteInstance* site_instance, |
| 600 int history_length, | |
| 601 int32 minimum_page_id) { | |
| 602 // SetHistoryLengthAndPrune doesn't handle pending cross-site navigations | |
| 603 // cleanly. Since it's only used when swapping in instant and prerendered | |
|
jam
2011/08/15 15:59:10
ditto
| |
| 604 // TabContents, checks are done at a higher level to ensure that the pages | |
| 605 // are not swapped in during this case. | |
| 606 if (render_manager_.pending_render_view_host()) { | |
| 607 NOTREACHED(); | |
| 608 return; | |
| 609 } | |
| 600 RenderViewHost* rvh = render_view_host(); | 610 RenderViewHost* rvh = render_view_host(); |
| 601 if (!rvh) | 611 if (!rvh) { |
| 612 NOTREACHED(); | |
| 602 return; | 613 return; |
| 603 rvh->Send(new ViewMsg_SetHistoryLengthAndClear(rvh->routing_id(), | 614 } |
| 604 history_length)); | 615 if (site_instance && rvh->site_instance() != site_instance) { |
| 616 NOTREACHED(); | |
| 617 return; | |
| 618 } | |
| 619 rvh->Send(new ViewMsg_SetHistoryLengthAndPrune(rvh->routing_id(), | |
| 620 history_length, | |
| 621 minimum_page_id)); | |
| 605 } | 622 } |
| 606 | 623 |
| 607 void TabContents::Stop() { | 624 void TabContents::Stop() { |
| 608 render_manager_.Stop(); | 625 render_manager_.Stop(); |
| 609 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); | 626 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); |
| 610 } | 627 } |
| 611 | 628 |
| 612 TabContents* TabContents::Clone() { | 629 TabContents* TabContents::Clone() { |
| 613 // We create a new SiteInstance so that the new tab won't share processes | 630 // We create a new SiteInstance so that the new tab won't share processes |
| 614 // with the old one. This can be changed in the future if we need it to share | 631 // with the old one. This can be changed in the future if we need it to share |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1920 } | 1937 } |
| 1921 | 1938 |
| 1922 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1939 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 1923 render_manager_.SwapInRenderViewHost(rvh); | 1940 render_manager_.SwapInRenderViewHost(rvh); |
| 1924 } | 1941 } |
| 1925 | 1942 |
| 1926 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1943 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1927 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1944 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1928 rwh_view->SetSize(view()->GetContainerSize()); | 1945 rwh_view->SetSize(view()->GetContainerSize()); |
| 1929 } | 1946 } |
| OLD | NEW |