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

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

Issue 165468: Take 2 at fixing anchor links opening in background tabs on linux. (Closed)
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
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 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 } 1824 }
1825 1825
1826 if (disposition == NEW_POPUP) { 1826 if (disposition == NEW_POPUP) {
1827 BuildPopupWindow(source, new_contents, initial_pos); 1827 BuildPopupWindow(source, new_contents, initial_pos);
1828 } else if (disposition == NEW_WINDOW) { 1828 } else if (disposition == NEW_WINDOW) {
1829 Browser* browser = Browser::Create(profile_); 1829 Browser* browser = Browser::Create(profile_);
1830 browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB, 1830 browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB,
1831 initial_pos, user_gesture); 1831 initial_pos, user_gesture);
1832 browser->window()->Show(); 1832 browser->window()->Show();
1833 } else if (disposition != SUPPRESS_OPEN) { 1833 } else if (disposition != SUPPRESS_OPEN) {
1834 // Ensure that the new TabContentsView begins at the same size as the
1835 // previous TabContentsView if it existed. Otherwise, the initial WebKit
1836 // layout will be performed based on a width of 0 pixels, causing a
1837 // very long, narrow, inaccurate layout. Because some scripts on pages (as
1838 // well as WebKit's anchor link location calculation) are run on the
1839 // initial layout and not recalculated later, we need to ensure the first
1840 // layout is performed with sane view dimensions even when we're opening a
1841 // new background tab.
1842 if (TabContents* old_contents = tabstrip_model_.GetSelectedTabContents()) {
1843 new_contents->view()->SizeContents(
1844 old_contents->view()->GetContainerSize());
1845 }
1834 tabstrip_model_.AddTabContents(new_contents, -1, false, 1846 tabstrip_model_.AddTabContents(new_contents, -1, false,
1835 PageTransition::LINK, 1847 PageTransition::LINK,
1836 disposition == NEW_FOREGROUND_TAB); 1848 disposition == NEW_FOREGROUND_TAB);
1837 } 1849 }
1838 } 1850 }
1839 1851
1840 void Browser::ActivateContents(TabContents* contents) { 1852 void Browser::ActivateContents(TabContents* contents) {
1841 tabstrip_model_.SelectTabContentsAt( 1853 tabstrip_model_.SelectTabContentsAt(
1842 tabstrip_model_.GetIndexOfTabContents(contents), false); 1854 tabstrip_model_.GetIndexOfTabContents(contents), false);
1843 window_->Activate(); 1855 window_->Activate();
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 /////////////////////////////////////////////////////////////////////////////// 2807 ///////////////////////////////////////////////////////////////////////////////
2796 // BrowserToolbarModel (private): 2808 // BrowserToolbarModel (private):
2797 2809
2798 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 2810 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
2799 // This |current_tab| can be NULL during the initialization of the 2811 // This |current_tab| can be NULL during the initialization of the
2800 // toolbar during window creation (i.e. before any tabs have been added 2812 // toolbar during window creation (i.e. before any tabs have been added
2801 // to the window). 2813 // to the window).
2802 TabContents* current_tab = browser_->GetSelectedTabContents(); 2814 TabContents* current_tab = browser_->GetSelectedTabContents();
2803 return current_tab ? &current_tab->controller() : NULL; 2815 return current_tab ? &current_tab->controller() : NULL;
2804 } 2816 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698