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

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

Issue 9264049: Allow SiteInstance for about:blank in new tab to be reused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix spacing. Created 8 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 void TabContents::RenderViewDeleted(RenderViewHost* rvh) { 1744 void TabContents::RenderViewDeleted(RenderViewHost* rvh) {
1745 render_manager_.RenderViewDeleted(rvh); 1745 render_manager_.RenderViewDeleted(rvh);
1746 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); 1746 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh));
1747 } 1747 }
1748 1748
1749 void TabContents::DidNavigate(RenderViewHost* rvh, 1749 void TabContents::DidNavigate(RenderViewHost* rvh,
1750 const ViewHostMsg_FrameNavigate_Params& params) { 1750 const ViewHostMsg_FrameNavigate_Params& params) {
1751 if (content::PageTransitionIsMainFrame(params.transition)) 1751 if (content::PageTransitionIsMainFrame(params.transition))
1752 render_manager_.DidNavigateMainFrame(rvh); 1752 render_manager_.DidNavigateMainFrame(rvh);
1753 1753
1754 // Update the site of the SiteInstance if it doesn't have one yet. 1754 // Update the site of the SiteInstance if it doesn't have one yet, unless
1755 if (!static_cast<SiteInstanceImpl*>(GetSiteInstance())->HasSite()) 1755 // this is for about:blank. In that case, the SiteInstance can still be
1756 // considered unused until a navigation to a real page.
1757 if (!static_cast<SiteInstanceImpl*>(GetSiteInstance())->HasSite() &&
1758 params.url != GURL(chrome::kAboutBlankURL)) {
1756 static_cast<SiteInstanceImpl*>(GetSiteInstance())->SetSite(params.url); 1759 static_cast<SiteInstanceImpl*>(GetSiteInstance())->SetSite(params.url);
1760 }
1757 1761
1758 // Need to update MIME type here because it's referred to in 1762 // Need to update MIME type here because it's referred to in
1759 // UpdateNavigationCommands() called by RendererDidNavigate() to 1763 // UpdateNavigationCommands() called by RendererDidNavigate() to
1760 // determine whether or not to enable the encoding menu. 1764 // determine whether or not to enable the encoding menu.
1761 // It's updated only for the main frame. For a subframe, 1765 // It's updated only for the main frame. For a subframe,
1762 // RenderView::UpdateURL does not set params.contents_mime_type. 1766 // RenderView::UpdateURL does not set params.contents_mime_type.
1763 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) 1767 // (see http://code.google.com/p/chromium/issues/detail?id=2929 )
1764 // TODO(jungshik): Add a test for the encoding menu to avoid 1768 // TODO(jungshik): Add a test for the encoding menu to avoid
1765 // regressing it again. 1769 // regressing it again.
1766 if (content::PageTransitionIsMainFrame(params.transition)) 1770 if (content::PageTransitionIsMainFrame(params.transition))
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 encoding_ = content::GetContentClient()->browser()-> 2295 encoding_ = content::GetContentClient()->browser()->
2292 GetCanonicalEncodingNameByAliasName(encoding); 2296 GetCanonicalEncodingNameByAliasName(encoding);
2293 } 2297 }
2294 2298
2295 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2299 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2296 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2300 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2297 // Can be NULL during tests. 2301 // Can be NULL during tests.
2298 if (rwh_view) 2302 if (rwh_view)
2299 rwh_view->SetSize(GetView()->GetContainerSize()); 2303 rwh_view->SetSize(GetView()->GetContainerSize());
2300 } 2304 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | content/browser/tab_contents/tab_contents_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698