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::SetHistoryLengthAndClear(const SiteInstance* site_instance, |
| 600 int history_length, | |
| 601 int32 page_id) { | |
| 600 RenderViewHost* rvh = render_view_host(); | 602 RenderViewHost* rvh = render_view_host(); |
| 601 if (!rvh) | 603 if (!rvh) |
| 602 return; | 604 return; |
| 605 // It's possible that the current render view host is different from the | |
| 606 // one that needs to be pruned. | |
|
Charlie Reis
2011/08/11 20:49:24
Well, we're hoping it isn't possible if called cor
| |
| 607 if (rvh->site_instance() != site_instance) { | |
| 608 LOG(ERROR) << "Mismatches site instance"; | |
| 609 return; | |
| 610 } | |
| 603 rvh->Send(new ViewMsg_SetHistoryLengthAndClear(rvh->routing_id(), | 611 rvh->Send(new ViewMsg_SetHistoryLengthAndClear(rvh->routing_id(), |
| 604 history_length)); | 612 history_length, |
| 613 page_id)); | |
| 605 } | 614 } |
| 606 | 615 |
| 607 void TabContents::Stop() { | 616 void TabContents::Stop() { |
| 608 render_manager_.Stop(); | 617 render_manager_.Stop(); |
| 609 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); | 618 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); |
| 610 } | 619 } |
| 611 | 620 |
| 612 TabContents* TabContents::Clone() { | 621 TabContents* TabContents::Clone() { |
| 613 // We create a new SiteInstance so that the new tab won't share processes | 622 // 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 | 623 // 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 } | 1929 } |
| 1921 | 1930 |
| 1922 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1931 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 1923 render_manager_.SwapInRenderViewHost(rvh); | 1932 render_manager_.SwapInRenderViewHost(rvh); |
| 1924 } | 1933 } |
| 1925 | 1934 |
| 1926 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1935 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1927 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1936 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1928 rwh_view->SetSize(view()->GetContainerSize()); | 1937 rwh_view->SetSize(view()->GetContainerSize()); |
| 1929 } | 1938 } |
| OLD | NEW |