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

Side by Side Diff: chrome/browser/browser.cc

Issue 160424: Merge 22016 - Force sizing of a new tab as soon as TabContents is created.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 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
« no previous file with comments | « no previous file | chrome/browser/views/tab_contents/tab_contents_view_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/browser.cc:r22016
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "chrome/browser/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "app/animation.h" 7 #include "app/animation.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/idle_timer.h" 10 #include "base/idle_timer.h"
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 return TAB_TEAROFF_ACTION | (tab_count() > 1 ? TAB_MOVE_ACTION : 0); 1456 return TAB_TEAROFF_ACTION | (tab_count() > 1 ? TAB_MOVE_ACTION : 0);
1457 } 1457 }
1458 1458
1459 TabContents* Browser::CreateTabContentsForURL( 1459 TabContents* Browser::CreateTabContentsForURL(
1460 const GURL& url, const GURL& referrer, Profile* profile, 1460 const GURL& url, const GURL& referrer, Profile* profile,
1461 PageTransition::Type transition, bool defer_load, 1461 PageTransition::Type transition, bool defer_load,
1462 SiteInstance* instance) const { 1462 SiteInstance* instance) const {
1463 TabContents* contents = new TabContents(profile, instance, 1463 TabContents* contents = new TabContents(profile, instance,
1464 MSG_ROUTING_NONE, NULL); 1464 MSG_ROUTING_NONE, NULL);
1465 1465
1466 // Ensure that the new TabContentsView begins at the same size as the
1467 // previous TabContentsView if it existed. Otherwise, the initial WebKit
1468 // layout will be performed based on a width of 0 pixels, causing a
1469 // very long, narrow, inaccurate layout. Because some scripts on pages (as
1470 // well as WebKit's anchor link location calculation) are run on the initial
1471 // layout and not recalculated later, we need to ensure the first layout is
1472 // performed with sane view dimensions even when we're opening a new
1473 // background tab.
1474 if (TabContents* old_contents = tabstrip_model_.GetSelectedTabContents())
1475 contents->view()->SizeContents(old_contents->view()->GetContainerSize());
1476
1466 if (!defer_load) { 1477 if (!defer_load) {
1467 // Load the initial URL before adding the new tab contents to the tab strip 1478 // Load the initial URL before adding the new tab contents to the tab strip
1468 // so that the tab contents has navigation state. 1479 // so that the tab contents has navigation state.
1469 contents->controller().LoadURL(url, referrer, transition); 1480 contents->controller().LoadURL(url, referrer, transition);
1470 } 1481 }
1471 1482
1472 return contents; 1483 return contents;
1473 } 1484 }
1474 1485
1475 bool Browser::CanDuplicateContentsAt(int index) { 1486 bool Browser::CanDuplicateContentsAt(int index) {
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 /////////////////////////////////////////////////////////////////////////////// 2784 ///////////////////////////////////////////////////////////////////////////////
2774 // BrowserToolbarModel (private): 2785 // BrowserToolbarModel (private):
2775 2786
2776 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 2787 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
2777 // This |current_tab| can be NULL during the initialization of the 2788 // This |current_tab| can be NULL during the initialization of the
2778 // toolbar during window creation (i.e. before any tabs have been added 2789 // toolbar during window creation (i.e. before any tabs have been added
2779 // to the window). 2790 // to the window).
2780 TabContents* current_tab = browser_->GetSelectedTabContents(); 2791 TabContents* current_tab = browser_->GetSelectedTabContents();
2781 return current_tab ? &current_tab->controller() : NULL; 2792 return current_tab ? &current_tab->controller() : NULL;
2782 } 2793 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/tab_contents/tab_contents_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698