Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 7649009: Merge of 97624 to 835 branch. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // testing. 364 // testing.
365 if (GetSiteInstance()) 365 if (GetSiteInstance())
366 GetSiteInstance()->UpdateMaxPageID(page_id); 366 GetSiteInstance()->UpdateMaxPageID(page_id);
367 GetRenderProcessHost()->UpdateMaxPageID(page_id); 367 GetRenderProcessHost()->UpdateMaxPageID(page_id);
368 } 368 }
369 369
370 SiteInstance* TabContents::GetSiteInstance() const { 370 SiteInstance* TabContents::GetSiteInstance() const {
371 return render_manager_.current_host()->site_instance(); 371 return render_manager_.current_host()->site_instance();
372 } 372 }
373 373
374 SiteInstance* TabContents::GetPendingSiteInstance() const {
375 RenderViewHost* dest_rvh = render_manager_.pending_render_view_host() ?
376 render_manager_.pending_render_view_host() :
377 render_manager_.current_host();
378 return dest_rvh->site_instance();
379 }
380
374 bool TabContents::ShouldDisplayURL() { 381 bool TabContents::ShouldDisplayURL() {
375 // Don't hide the url in view source mode and with interstitials. 382 // Don't hide the url in view source mode and with interstitials.
376 NavigationEntry* entry = controller_.GetActiveEntry(); 383 NavigationEntry* entry = controller_.GetActiveEntry();
377 if (entry && (entry->IsViewSourceMode() || 384 if (entry && (entry->IsViewSourceMode() ||
378 entry->page_type() == INTERSTITIAL_PAGE)) { 385 entry->page_type() == INTERSTITIAL_PAGE)) {
379 return true; 386 return true;
380 } 387 }
381 388
382 // We always display the URL for non-WebUI URLs to prevent spoofing. 389 // We always display the URL for non-WebUI URLs to prevent spoofing.
383 if (entry && !content::WebUIFactory::Get()->HasWebUIScheme(entry->url())) 390 if (entry && !content::WebUIFactory::Get()->HasWebUIScheme(entry->url()))
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 FOR_EACH_OBSERVER(TabContentsObserver, 584 FOR_EACH_OBSERVER(TabContentsObserver,
578 observers_, 585 observers_,
579 NavigateToPendingEntry(entry.url(), reload_type)); 586 NavigateToPendingEntry(entry.url(), reload_type));
580 587
581 if (delegate_) 588 if (delegate_)
582 delegate_->DidNavigateToPendingEntry(this); 589 delegate_->DidNavigateToPendingEntry(this);
583 590
584 return true; 591 return true;
585 } 592 }
586 593
587 void TabContents::SetHistoryLengthAndClear(int history_length) { 594 void TabContents::SetHistoryLengthAndPrune(const SiteInstance* site_instance,
595 int history_length,
596 int32 minimum_page_id) {
597 // SetHistoryLengthAndPrune doesn't handle pending cross-site navigations
598 // cleanly. Since it's only used when swapping in instant and prerendered
599 // TabContents, checks are done at a higher level to ensure that the pages
600 // are not swapped in during this case.
601 if (render_manager_.pending_render_view_host()) {
602 NOTREACHED();
603 return;
604 }
588 RenderViewHost* rvh = render_view_host(); 605 RenderViewHost* rvh = render_view_host();
589 if (!rvh) 606 if (!rvh) {
607 NOTREACHED();
590 return; 608 return;
591 rvh->Send(new ViewMsg_SetHistoryLengthAndClear(rvh->routing_id(), 609 }
592 history_length)); 610 if (site_instance && rvh->site_instance() != site_instance) {
611 NOTREACHED();
612 return;
613 }
614 rvh->Send(new ViewMsg_SetHistoryLengthAndPrune(rvh->routing_id(),
615 history_length,
616 minimum_page_id));
593 } 617 }
594 618
595 void TabContents::Stop() { 619 void TabContents::Stop() {
596 render_manager_.Stop(); 620 render_manager_.Stop();
597 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); 621 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation());
598 } 622 }
599 623
600 TabContents* TabContents::Clone() { 624 TabContents* TabContents::Clone() {
601 // We create a new SiteInstance so that the new tab won't share processes 625 // We create a new SiteInstance so that the new tab won't share processes
602 // with the old one. This can be changed in the future if we need it to share 626 // with the old one. This can be changed in the future if we need it to share
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 } 1907 }
1884 1908
1885 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { 1909 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) {
1886 render_manager_.SwapInRenderViewHost(rvh); 1910 render_manager_.SwapInRenderViewHost(rvh);
1887 } 1911 }
1888 1912
1889 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 1913 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
1890 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 1914 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
1891 rwh_view->SetSize(view()->GetContainerSize()); 1915 rwh_view->SetSize(view()->GetContainerSize());
1892 } 1916 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/test_tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698