OLD | NEW |
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 "chrome/browser/ui/tabs/tab_strip_model.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 // Ensure that the new WebContentsView begins at the same size as the | 786 // Ensure that the new WebContentsView begins at the same size as the |
787 // previous WebContentsView if it existed. Otherwise, the initial WebKit | 787 // previous WebContentsView if it existed. Otherwise, the initial WebKit |
788 // layout will be performed based on a width of 0 pixels, causing a | 788 // layout will be performed based on a width of 0 pixels, causing a |
789 // very long, narrow, inaccurate layout. Because some scripts on pages (as | 789 // very long, narrow, inaccurate layout. Because some scripts on pages (as |
790 // well as WebKit's anchor link location calculation) are run on the | 790 // well as WebKit's anchor link location calculation) are run on the |
791 // initial layout and not recalculated later, we need to ensure the first | 791 // initial layout and not recalculated later, we need to ensure the first |
792 // layout is performed with sane view dimensions even when we're opening a | 792 // layout is performed with sane view dimensions even when we're opening a |
793 // new background tab. | 793 // new background tab. |
794 if (WebContents* old_contents = GetActiveWebContents()) { | 794 if (WebContents* old_contents = GetActiveWebContents()) { |
795 if ((add_types & ADD_ACTIVE) == 0) { | 795 if ((add_types & ADD_ACTIVE) == 0) { |
796 ResizeWebContents(contents, old_contents->GetContainerBounds().size()); | 796 ResizeWebContents( |
| 797 contents, gfx::Rect(old_contents->GetContainerBounds().size())); |
797 } | 798 } |
798 } | 799 } |
799 } | 800 } |
800 | 801 |
801 void TabStripModel::CloseSelectedTabs() { | 802 void TabStripModel::CloseSelectedTabs() { |
802 InternalCloseTabs(selection_model_.selected_indices(), | 803 InternalCloseTabs(selection_model_.selected_indices(), |
803 CLOSE_CREATE_HISTORICAL_TAB | CLOSE_USER_GESTURE); | 804 CLOSE_CREATE_HISTORICAL_TAB | CLOSE_USER_GESTURE); |
804 } | 805 } |
805 | 806 |
806 void TabStripModel::SelectNextTab() { | 807 void TabStripModel::SelectNextTab() { |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 | 1365 |
1365 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { | 1366 void TabStripModel::FixOpenersAndGroupsReferencing(int index) { |
1366 WebContents* old_contents = GetWebContentsAtImpl(index); | 1367 WebContents* old_contents = GetWebContentsAtImpl(index); |
1367 for (WebContentsData* data : contents_data_) { | 1368 for (WebContentsData* data : contents_data_) { |
1368 if (data->group() == old_contents) | 1369 if (data->group() == old_contents) |
1369 data->set_group(contents_data_[index]->group()); | 1370 data->set_group(contents_data_[index]->group()); |
1370 if (data->opener() == old_contents) | 1371 if (data->opener() == old_contents) |
1371 data->set_opener(contents_data_[index]->opener()); | 1372 data->set_opener(contents_data_[index]->opener()); |
1372 } | 1373 } |
1373 } | 1374 } |
OLD | NEW |